USER'S CHOICE POST

Internet Download Manager free download for life time activated
Top 10 software you must have in your computer/laptop/tab with free download link

Earn upto Rs. 9,000 pm checking Emails. Join now! And get Rs. 99 Instantly!

ALL THE INFORMATION GIVEN IN THIS SITE IS ONLY FOR THE LEARNING PURPOSE. WE SHOULD ALWAYS USE THE GENUINE SOFTWARE! USE OF ANY INFORMATION GIVEN HERE IS SOLELY USERS' RESPONSIBILITY!


Thursday, 7 June 2012

SUM OF POSITIVE INTEGER

Filled under:


SUM OF POSITIVE INTEGER OR SUMMATION OF THE SERIES 1+2+3+........+upto n


CODE:


#include<stdio.h>
#include<conio.h>
int series(int);
int main()
{
 int n,s;
 clrscr();
 printf("Enter the nth term of the series:");
 scanf("%d",&n);
 s=series(n);
 printf("The sum of series:1+2+3+........+%d=%d",n,s);

 getch();
 return 0;
 }
 int series(int a)
 {
   int i,sum=0;
    for(i=1;i<=a;i++)
    sum=sum+i;
    return sum;
}



OUTPUT:
Enter the nth term of the series 5
The sum of series:1+2+3+........+5=15




**IMPORTANT-WAIT A MINUTE SHARE IT WITH YOUR FRIENDS.. CLICK ON THE LINKS BELOW PLEASE..IT WILL NOT TAKE MORE THAN 10 SECOND.. PLEASE HELP US..SHARE THIS...

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...


Try New Whatsapp+ latest for free with lots of new Emoticons :) , Latest Version
Download NOW