write a C program to find the average of three numbers
Answers
Answered by
3
The given program is written in C.
#include <stdio.h>
int main() {
float a,b,c,av;
printf("Enter first number: ");
scanf("%f",&a);
printf("Enter second number: ");
scanf("%f",&b);
printf("Enter third number: ");
scanf("%f",&c);
av=(a+b+c)/3;
printf("Average of the numbers is: %.2f",av);
}
- Accept three numbers.
- Add the numbers and divide the sum by 3. Store the result in a variable, say av.
- Display the value of av.
See the attachment for output.
Attachments:
Similar questions