**#include<stdio.h>**

#include<conio.h>

void main()

{

int i=1,sum=0,n;

clrscr();

printf("enter the number ");

scanf("%d",&n);

while(i<=n)

{

if(i%2!=0)

{

sum=sum+i;

}

i=i+1;

}

printf("sum of odd number=%d",sum);

getch();

}

#include<conio.h>

void main()

{

int i=1,sum=0,n;

clrscr();

printf("enter the number ");

scanf("%d",&n);

while(i<=n)

{

if(i%2!=0)

{

sum=sum+i;

}

i=i+1;

}

printf("sum of odd number=%d",sum);

getch();

}

output is not here

ReplyDeleteConio is not needed now

ReplyDelete