Programming C : Write a C program to find the number and sum of all integers from 100 and less than 200 that are divisible by 7.

Programming C : Write a C program to find the number and sum of all integers from 100 and less than 200 that are divisible by 7.

Programming C

Problem : Write a C program to find the number and sum of all integers from 100 and less than 200 that are divisible by 7.

/*
Author : Sabya Roy
*/




 
#include<stdio.h>
#include<conio.h>
main ()
{
             int i, summation=0;                                                          //Taking variables
             for (i=100; i<=200; i=i+1)                                               //For loop and condition
             {
                          if(i%7==0)                                                               //Condition for ‘divided by 7’
                          {
                                       summation=summation+i;                     //add the getting integer number
                                       if (i==105)
                                       {
                                                    printf(“Series : \n%d\n”,i);       //Show the answer
                                       }
                                       else
                                       printf(“%d\n”, i);                                     //Show the answer/series full
                          }
             }
             printf(“Summation of Series : %d”, summation);      //Show the answer of summation
             getch();
}

———————————————————————————————————————————————————-

Output :

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *