Here is an example :
int howMany = 0;
cin >> howMany;
for(int i = 0; i < 100; i ++)
if(i % howMany == 0) cout << i;
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
You ask the user to give you a number so you can
show every multiple answers of that number.
so int your loop check if the index 'i' is a multiple of that number,
if so then print the answer. Using the mod operator gives
the remainder of the division. If the remainder is a 0 , then the
number is a multiple of that number.
for example : 6 % 2 = 0. because 2 goes into 6 3 times with no
remainder.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608