Tuesday, 14 May 2013

5. Find the sum and average of 3 numbers


5. /* Find the sum and average of 3 numbers */
main()
{
float a,b,c,sum,avg;
a=b=c=0;
clrscr();
printf("Enter the value of a -> ");
scanf("%f",&a);
printf("\n\nEnter the value of b -> ");
scanf("%f",&b);
printf("\n\nEnter the value of c -> ");
scanf("%f",&c);
sum=a+b+c;
avg=sum/3;
printf("\n\n Sum is %8.0f",sum);
printf("\n\n Average is %10.2f",avg);
getch();
}

No comments:

Post a Comment