ads

Sunday, 28 August 2016

c program to calculate the sum of N element

#include<stdio.h>
#include<conio.h>
void main()
{
  int i,sum=0,n;
  printf("enter the number:");
  scanf("%d",&n);
  for(i=1;i<=n;i++)
 {
    sum=sum+i;
  }
  printf("sum=%d",sum);
  getch();
}

No comments:

Post a Comment