Logo 
Search:

C Programming Answers

Ask Question   UnAnswered
Home » Forum » C Programming       RSS Feeds
  Question Asked By: Mrityunjoy Chatterjee   on Feb 04 In C Programming Category.

  
Question Answered By: MD.REZA AHMED   on Feb 04

try this one ...


#include<stdio.h>
int main()
{
int i=1,n,c=0;
printf("\n Enter the no of natural numbers u want to add\n");
scanf("%d",&n);
printf("\n The Sum is ...");
while(i<=n)
{
c+=i;
if(i!=n)
printf("%2d+",i++);
else
printf("%2d",i++);
}
printf("=%2d",c);
return 0;
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on sum of series of natural numbers Or get search suggestion and latest updates.


Tagged: