/* Q. Write a program to find the number of and
sum of all integer greater than 100 and less than 200
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0;
clrscr();
printf("All nos. between 100 - 200 which is divisible by 5\n");
for(i=101;i<200;i++)
{
if(i%5==0)
{
printf("%5d",i);
sum+=i;
}
}
printf("\n\nsum = %d",sum);
getch();
}
Output:-
All nos. between 100 - 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
No comments:
Post a Comment