How would I go about doing this:
Write a program that asks the user to enter a number between 1 - 5. Your program should display all the numbers between 1-20 that are evenly divisible by this number. You will need to use a loop.
Thanks,
How would I go about doing this:
Write a program that asks the user to enter a number between 1 - 5. Your program should display all the numbers between 1-20 that are evenly divisible by this number. You will need to use a loop.
Thanks,
We're not going to do your homework for you - please post the code that you have, and any specific questions, and we can point you in the right direction.
A simple (infinite) loop would be...
Oh and the inside is a loop as well - from 1 to 20.
Code:while (1) { /* ask for user input */ for (i = 1; i <=20; i++) { /* display the number i if it's divisible by the user's number */ } }