Tuesday, 30 June 2015

Program 3 : Write a program to find sum of all integers greater than 100 & less than 200 and are divisible by 5.

#include<stdio.h>

void main() 

{

    int i, sum = 0;

    for (i = 101; i < 200; i++) {

        if (i % 5 == 0) {

            sum = sum + i;

        }

    }

    printf("SUM is :%d", sum);

}

No comments:

Post a Comment