Problem 02: Write a for loop which will print summation of all the numbers which are divied by 3 and 5 between 30-120.
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
Comments
Leave a comment