Take 3 values find out average of three values check with result is less than 500 and result is greater than 500
#include <stdio.h>
int main()
{
int a, b, c;
float average;
printf("Enter 3 integers: ");
if(scanf("%d %d %d", &a, &b, &c) != 3)
{
printf("Bad input\n");
return 1;
}
average = (float)(a + b + c) / 3;
printf("Average: %f\n", average);
if(average < 500)
{
printf("Average is less than 500\n");
}
else
if(average > 500)
{
printf("Average is greater than 500\n");
}
return 0;
}
Comments
Leave a comment