Answer to Question #261865 in C for Amraj

Question #261865

Problem 02: Write a for loop which will print summation of all the numbers which are divied by 3 and 5 between 30-120.

1
Expert's answer
2021-11-10T00:05:08-0500

Source code



#include <stdio.h>


int main()
{
    int sum=0;
    
    for(int i=30;i<=120;i++){
        if (i%3==0 && i%5==0){
            sum+=i;
        }
    }
    printf("\nSummation of all the numbers which are divied by 3 and 5 between 30-120 =  %d",sum);
    return 0;
}

Output


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS