Showing posts with label sum of integers. Show all posts
Showing posts with label sum of integers. Show all posts

Saturday, April 28, 2018

C program to display the sum of all integers from one to 100

Program code
#include <stdio.h>
#include <conio.h>
void main()
{
int i, sum=0;
clrscr();
for (i=1;i<=100;i++)
sum=sum+i;
printf(“The sum of all integers from one to 100 is %d.\n”,sum);
getch();
}

Output
The sum of all integers from one to 100 is 5050.