# Input decimal numbers and find their sum and average in C

###### scanf() - Question 2

In this question, we will see how to input 5 decimal numbers in C programming using the scanf() function and find their sum and average. To know more about scanf() function click on the scanf() function lesson.

**Q2)** Write a program in C to input 5 decimal numbers and find their sum and average.

#### Program

```
#include <stdio.h>
#include <conio.h>
int main()
{
float a,b,c,d,e,sum,avg;
printf("Enter 5 decimal numbers\n");
scanf("%f%f%f%f%f",&a,&b,&c,&d,&e);
sum=a+b+c+d+e;
avg=sum/5;
printf("Sum=%f\n",sum);
printf("Average=%f",avg);
return 0;
}
```

#### Output

Enter 5 decimal numbers 12.36 15.1 3.24 18.9 21.17 Sum=70.769997 Average=14.153999