google-site-verification: googlef8aa845b858144d3.html COMPUTER SCIENCE NOTES: Sum of series 1+2+3+... using formula

Monday, July 17, 2017

Sum of series 1+2+3+... using formula

/*find the sum of series 1+2+3+... using formula */
#include<stdio.h>
#include<conio.h>
void main()
{
int num,sum=0;
clrscr();
printf("Enter index of series from like (1 to 10)");
scanf("%d",&num);
sum=num*(num+1)/2;
printf("sum of series %d",sum);
getch();
}

No comments:

Post a Comment