Computer Science, asked by eddggh8304, 7 months ago

Write a program to accept 5 numbers and find the sum and average

Answers

Answered by Devanshpandey1678
7

Answer:

That answer is so easy please follow and mark me brain list

Answered by cuterekhadhankher
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