recent

C Program To Find Sum Of N Numbers

C Program To Find Sum Of N Numbers

#include<stdio.h>

int main()
{
   int n,sum=0;

   printf("Enter n number to add: ");
   scanf("%d",&n);    //input from user

 for(i=0;i<=n;i++)
{
   sum = sum+n;
 }
   printf("Sum : %d\n", sum);   //print ouput on screen
}
Powered by Blogger.