#include<stdio.h>
#include<conio.h>
void main()
{int a,b,c;
float sum=0,avg;
printf("enter a number");
scanf("%d",&a);
printf("enter other number");
scanf("%d",&b);
for(c=a;c<=b;c++)
sum=sum+c;
avg=sum/(b-a+1);
printf("\nsum%f",sum);
printf("\navg%f",avg);
getch();
}
No comments:
Post a Comment