Greetings!!! 🙂
Can someone edit the following code to ask a user the number (n)?; where the code could run and find the first whole number divisible by all the numbers from 1 to n. Below example displays the first whole number which is divisible by all the numbers from 1 to 13.
***********
function first_whole_numberi=1;while i>=0 if mod(i,2)==0 && mod(i,3)==0 && mod(i,4)==0 && mod(i,5)==0 && mod(i,6)==0 && mod(i,7)==0 && mod(i,8)==0 && mod(i,9)==0 && mod(i,10)==0 && mod(i,11)==0 && mod(i,12)==0 && mod(i,13)==0 break; else i=i+1; endendfprintf('\n\nthe first whole number divisible by 1 to 13 is %d\nThankyou\n\n\n',i);end
**********
THANKYOU 🙂
Best Answer