-->

Facebook

Jasper Roberts - Blog

Monday, October 6, 2014

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

#include<stdio.h>
#include<conio.h>

void main()
{
int i, sum=0;

     clrscr();
    
printf("\n Numbers between 100 to 200 which is divisible by 5");

for(i=101;i<200;i++)
     {
if(i%5==0)
          {
               printf("\n %d",i);
              sum= sum + i;
          }
     }

printf("\n sum = %d",sum);
     getch();
}

OUTPUT:
 Numbers between 100 to 200 which is divisible by 5
 105
 110
 115
 120
 125
 130
 135
 140
 145
 150
 155
 160
 165
 170
 175
 180
 185
 190
 195
 sum = 2850

11 comments: