Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in a script file that finds the smallest odd integer that is div

ID: 3532195 • Letter: W

Question

Write a program in a script file that finds the smallest odd integer that is divisible by 17 and whose square root is greater than 200. Use a for-loop in the program. The loop should start from 1 and stop when the number is found. The program prints the message "The required number is:" and then prints the number. Hint: Use rem(n, 2)~=0 for finding odd integers, and rem(n, 17 )= 0 for finding the number to be divisible by 17. Show your program and the output. Write a program in a script file that uses for-end loops and if-end to count how many 3-digit numbers that are divisible by 3. Show your program and the output.

Explanation / Answer

%% (a)


for i=1:100000

if(rem(i,2)~=0 && rem(i,17)==0)

if(sqrt(i)>200)

break;

end

end

end

s = 'The required number is: ';

display (s);

display (i);



%% (b)

count = 0;

for i = 100:1000

if(rem(i,3)==0)

count = count+1;

end

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote