C Programme 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;

}





Output:





105 112  119  126  133  140  147  154  161  168  175  182  189  196



Sum of all above integers that are divisible by 7 is  2107

No comments:

Post a Comment