2.1 Ips

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1

7\11\22

Introduction to problem solving

Learn how to use looping constructs using C

Write a program to find sum of all integers greater than 100 & less than 200 and are divisible by 5.
#include <stdio.h>

int main()
{
int i=101,sum=0;
for(i;i<200;i++)
{
if (i%5==0)
sum += i;
}
printf("sum of the
series is %d",sum);
return 0;
}
No error

We take starting point and end point and use for loop to
start a loop from end point to end point if increment of 1
and use a conditional statement to make it print only if it is
divisible by 5

You might also like