Write a program for accepting 3 numbers from the user and adding them and to find the average in python
60 points
Answers
Answered by
0
This is programme for accepting 3 numbers from the user and adding them and to find the average in python
Attachments:
Answered by
1
Write a program for accepting 3 numbers from the user and adding them and to find the average in python
Answer:
#include<stdio.h>
int main()
{
// declare variable
float num1, num2, num3;
float sum, avg;
// take inputs
printf("Enter three Numbers: ");
scanf("%f %f %f",&num1, &num2, &num3);
// calculate sum
sum = num1 + num2 + num3;
// calculate average
avg = sum / 3;
// display entered numbers
printf("Entered numbers are: %.2f, %.2f and %.2f\n",
num1, num2, num3);
// display sum and average
printf("Sum=%.2f\n", sum);
printf("Average=%.2f\n",avg );
return 0;
}
Hope it helps! :)
Similar questions