Write a program to print all the odd number between one to ten (intrger) along with the sum.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int a = 1, s = 0;
clrscr ( );
while ( a <= 10 )
{
printf ("\n\n %d ",a);
s = s + a;
a = a + 2;
}
printf ("\n\n SUM OF ODD NUMBERS = %d",s);
getch ( );
}
Click here to contact us
No comments:
Post a Comment