Write a program find the sum of first 10 odd numbers

#include<stdio.h>
#include<conio.h>
int main()
{
int i,sum=0;
i=0;
do
{
if(i%2!=0)
sum=sum+i;
i++;
}while(i<=20);
printf("\n the sum of odd number is %d",sum);
}

No comments:

Post a Comment