Program to find Sum of ODD Number From 1 to N

#include<conio.h>

#include<stdio.h>

void main()

{

int sum,m,n,l;

clrscr();

printf("Enter the value of N");

scanf("%d",&l);

m=l+1;

n=m/2;

sum=n*n;

printf("Sum of odd numbers from 1 to N=%d",sum);

getch();

}

Output

Enter the value of N=9

25

Enter the value of N=11

36

Comments

Popular posts from this blog

Gove confirms mandatory housebuilding targets for councils will be abolished in face of Tory rebellion – UK politics live

Kotak Mahindra Bank Recruitment 2022 Released for Graduate Candidates And Apply Online