|Display series and sum of 1+3+..+n in c| | display n number of series in c|
.png)
C PROGRAM TO DISPLAY SERIES AND FIND SUM OF 1+3+5+....+n. Code: #include<stdio.h> int main() { int i,n,sum=1; printf("Enter any number n:"); scanf("%d",&n); printf("1"); for(i=3;i<=n;i++) { printf("+ %d ",i); sum=sum+i; i++; } printf("\nSum is: %d", sum); } Explanation: First we are declaring the variables in integer datatype. Next is we are asking the user to enter a number so that we can find the sum of series and display it. We are storing the user entered data in the variable "n" . using a for loop to perform the sum of series Finally, displaying the result with the sum of series . OUTPUT: ORWDWlBMZLWeDLN0Q0ejOB4mO_QnraratLWJCyTt36SboL9lNq7kzQCDVIjbEPIHbN1T7oYXTKpSfRa5f7hMgLkUGx91skiesZbyPcaepxHlbfr/s653/Screenshot%20(254).png" style="margin-left: 1em; margin-right: 1em;">