Program to find find sum of all number from 1 to N January 01, 2018 Programing In C No comments #include<conio.h> #include<stdio.h> void main() { int a,n,sum; clrscr(); printf("enter the value of N"); scanf("%d",&n); a=n*(n+1); sum=a/2; printf("sum of all the number from 1 to N is=%d",sum); getch(); } Output enter the value of N=10 sum of all the number from 1 to 10 is=55 enter the value of number from 1 to 20 is=210 Share This: Facebook Twitter Google+ Stumble Digg Email ThisBlogThis!Share to XShare to Facebook
0 comments:
Post a Comment