Write a program to print the sum of the series 1+2+3+4+... up to n terms.
C Programming Language / Loop control in C Language
1617Program:
#include int main() { int c, s=0, n; printf("\n Enter the No. of terms "); scanf("%d", &n); for(c=1;c<=n; c++) s+=c; printf("\n Sum is %d", s); getch(); return 0; }
Output:
Enter the No. of terms 6 Sum is 21
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS