c program to find the sum of n natural numbers,c program to find sum of first n natural numbers,add n numbers in c program,c program to find the sum of n numbers using function, write a program to find the sum of first n natural numbers,c program to find sum of n numbers using for loop,c program to find sum of first n natural numbers using recursion
#include"stdio.h"
#include"conio.h"
void main()
{
int i,limit,no[50],sum=0;
clrscr();
printf("Enter the limit=");
scanf("%d",&limit);
for(i=0;i<limit;i++)
{ no[i]=i+1;
sum=sum+no[i];
}
printf("\n\n Your array value is=");
for(i=0;i<limit;i++)
{
printf(" %d",no[i]);
}
printf("\n\nSum of all number is=%d",sum);
getch();
}
#include"conio.h"
void main()
{
int i,limit,no[50],sum=0;
clrscr();
printf("Enter the limit=");
scanf("%d",&limit);
for(i=0;i<limit;i++)
{ no[i]=i+1;
sum=sum+no[i];
}
printf("\n\n Your array value is=");
for(i=0;i<limit;i++)
{
printf(" %d",no[i]);
}
printf("\n\nSum of all number is=%d",sum);
getch();
}