Martes, Hunyo 7

C Programming: Display The Sum and Average of the Numbers



#include
 float main()
{
int add1, add2,add3,total;
float ave;

printf("Enter 3 numbers:\n");
scanf("%d%d%d",&add1, &add2,&add3);

total=(add1+add2+add3);
ave=(float)total/3;
printf("The total of %d %d and %d is %d\n",add1,add2,add3,total);
printf("and their average is %.2f", ave);



return 0;
}

0 comments:

Mag-post ng isang Komento

 
Powered by Blogger