Computer Science, asked by sofiey, 2 months ago

write a C program to find the average of three numbers​

Answers

Answered by anindyaadhikari13
3

\texttt{\textsf{\large{\underline{Solution}:}}}

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);

}

\texttt{\textsf{\large{\underline{Logic}:}}}

  • 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