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