//Write a program to print series of n term of natural number & also find sum using for loop #include<stdio.h> #include<conio.h> void main() { int i,n,sum=0; clrscr(); printf("Enter any term of number:\n"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("%d",i); sum=sum+i; } printf("Sum = %d",sum); getch(); }
Comments
Post a Comment