Programming C : Write a C program to find the numbers and sum of all integers greater than 50 and less than 300 that are divided by 9.

Programming C : Write a C program to find the numbers and sum of all integers greater than 50 and less than 300 that are divided by 9.

Programming C

Problem : Write a C program to find the numbers and sum of all integers greater than 50 and less than 300 that are divided by 9.

/*
Author : Sabya Roy
*/

 

#include<stdio.h>
#include<conio.h>
main ()
{
              int i, summation=0, k=1;              //Taking variables
              for (i=50; i<=300; i=i+1)             //using loop and condition
              {
                            if (i%9==0)                       //Condition to get number divided by 9
                            {
                                          summation=summation+i;                 //For add the series
                                          if (k==1)
                                          {
                                                        printf(“Series : \n%d\n”, i);  //Show answer (Series)
                                                        k++;
                                          }
                                          else
                                          printf(“%d\n”, i);                                  //Show answer(series)
                            }
              }
              printf(“Summation of Series : %d”, summation);     //Show Summation
              getch();
}

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




Output :

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

Share this post

Leave a Reply

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