How to calculate the summation of all the values from 30 to 120 which are divided by 3 and 5.

 #include <stdio.h>

#include <stdlib.h>


int main()

{

     int sum,i=30;

     printf("Value of sum : %d \n",sum);

     for(i;i<=120;i++){

        if(i%3==0 && i%5==0){

            sum = sum + i;

        }

     } printf("Total : %d",sum);


    return 0;

}


Comments