Search This Blog
C Program Find Sum Of First 100 Natural Numbers
C Program Find Sum Of First 100 Natural Numbers :
//C Program Find Sum Of First 100 Natural Numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum,temp;
clrscr();
sum=0;
temp=1;
for( i=0; i<100; i++ )
{
sum =sum+temp;
temp =temp+1;
}
printf("\n Natural Numbers= %d",sum);
getch();
}
OUTPUT#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum,temp;
clrscr();
sum=0;
temp=1;
for( i=0; i<100; i++ )
{
sum =sum+temp;
temp =temp+1;
}
printf("\n Natural Numbers= %d",sum);
getch();
}
Subscribe to:
Posts (Atom)