c program to find sum of first n numbers
#include<stdio.h>
#inclue<conio.h>
void main()
{
int sum=0,n=1,l;
printf("enter the limit");
scanf("%d",&l);
while(n<=l)
{
sum=sum+n;
}
printf("sum of first %d numbers=%d",l);
getch();
}
#inclue<conio.h>
void main()
{
int sum=0,n=1,l;
printf("enter the limit");
scanf("%d",&l);
while(n<=l)
{
sum=sum+n;
}
printf("sum of first %d numbers=%d",l);
getch();
}
Comments
Post a Comment