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,
This is a discussion on n00b Question- Loops within the C Programming forums, part of the General Programming Boards category; How would I go about doing this: Write a program that asks the user to enter a number between 1 ...
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 */ } }
What you should do first is write a flowchart. Reply after you've done that.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^