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