Skip to content

Instantly share code, notes, and snippets.

@snadahalli
Created November 8, 2013 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snadahalli/7371547 to your computer and use it in GitHub Desktop.
Save snadahalli/7371547 to your computer and use it in GitHub Desktop.
C Program to find the number and sum of all integers from 100 to 200 which is divisible by 7.
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/
#include<stdio.h>
int main()
{
int i,a[20],sum=0,b[20],counter=0,num=100;
printf("The numbers between 100 and 200 which are divisible by 7 are:\n");
for(i=100;i<=200;i++)
{
if(i%7==0)
{
sum=sum+i;
a[i]=i;
printf("\n");
printf(" %d",i);
}
}
printf("\nThe sum of numbers divisible by seven is %d", sum);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment