## The sum of n number of odd natural number in C

### Write a C program to display the n terms of odd natural numbers and their sum.

like: 1 3 5 7 … n

#include<stdio.h> void main () { int i,n,odd=0,sum=0; scanf("%d",&n); for(i=1;i<=n;i++){ if(i%2!=0){ printf ("%d",i); sum=i+n; } } printf("\nThe odd numbers are :%d\n",i); printf("The Sum of odd Natural Numbers upto 10 terms : %d\n",sum); }

Your article helped me a lot, is there any more related content? Thanks!