#include <stdio.h>
#include <conio.h>
void main()
{
int i;
float avg, s = 0.0;
clrscr();
for (i=1;i<=20;i++)
s = s + i;
avg = s / 20;
printf("The sum is %d\n", s);
printf("The average is %f\n", avg);
getch();
}
#include <conio.h>
void main()
{
int i;
float avg, s = 0.0;
clrscr();
for (i=1;i<=20;i++)
s = s + i;
avg = s / 20;
printf("The sum is %d\n", s);
printf("The average is %f\n", avg);
getch();
}
0 comments :
Post a Comment