Write a program to accept 5 numbers and find the sum and average
Answers
Answered by
7
Answer:
That answer is so easy please follow and mark me brain list
Answered by
6
Answer:
the solution varies with different programming languages
Explanation:
a) PYTHON
n=list(input().split())
sum=0
for i in n:
sum+=i
l=Len(n)
print("sum",sum)
print("average",sum/l)
b) C
#include<studio.h>
int main ()
{
int ar[5];
n=5;
for(i=0;i<n;i++)
{
scanf("%d",&ar[i]);
}
int sum=0;
float avg;
for(i=0;i<n;i++)
{
sum+=ar[i];
}
printf("%d",sum);
avg=sum/n;
printf("%f",avg);
return 0;
}
Similar questions
Physics,
3 months ago
India Languages,
7 months ago
Math,
7 months ago
Hindi,
11 months ago
Biology,
11 months ago