Monday, 24 August 2015

Write a C Program To print all the numbers and sum of all the integers that are greater then 100 and less than 200 and are divisible by 7

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

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

            for(i=100;i<200;i++)
            {
                        if(i%7==0)
                        {
                                    printf(" %d ",i);
                                    sum=sum+i;
                        }
            }

            printf("\n\n Sum of all above integers that are divisible by 7 is  %d",sum);

            getch();

            return 0;

}

No comments:

Post a Comment