Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Help with Multiples program code
11-21-2012, 08:15 PM #1
- Join Date
- Nov 2012
- Thanked 0 Times in 0 Posts
Help with Multiples program code
I need to create a pseudocode to calculate the sum of the multiples of 4 and 7 between a certain range m and n which will be inputted by the user.
Here is what i tried so far
Display “Please enter the smaller number in your range”
Display “Please enter the larger number in your range”
IF Multiple4 <=n AND >=m
IF Multiples7 <=n AND >=m
WHILE Multiples4 and Multiples7 <=n
It's just a snipped but There are many problems with this as you can see. A friend of mine was suggesting divide by the number and then check to see if there is a remainder instead or something. I need some help. Please suggest a method
12-15-2012, 05:40 AM #2
- Join Date
- Sep 2012
- Thanked 2 Times in 2 Posts
Hi ! I gave one example may be it will help you.
//Find the sum of all the multiples of 4 or 7 below 1000.
void main ()
a = i%4;
b = i%7;
iSum += i;
printf("\nThe sum of all the multiples of 4 or 7 below 1000: %d\n", iSum);