pages

Tuesday, 13 April 2021

c-program to calculate the average of 10 numbers| c-programming| c programming

 program to calculate the average of 10 numbers in c-programing.

In this program, we will calculate the average of 10 number  by using loop and taking 10 numbers form the user. 


#include<stdio.h>
#include<conio.h>
void main()
{
   int a[10],i,s=0;
   float avg;
   printf("enter the 10 numbers\n");
   for(i=0;i<10;i++)
         scanf("%d",&a[i]);
   for(i=0;i<10;i++){
            s=s+a[i];
            avg=s/10.0;
   }
   printf("the average of 10 number is %0.2f",avg);
   getch();
}

output: 














No comments:

Post a Comment