C Language

C Program to find Sum and average of 10 numbers using array.

In this tutorial we’ll learn how we can find Sum and Average of 10 numbers using array. First I’ll help you to understand the basic concept behind it , then we’ll move forward to write C program to find Sum and Average of 10 numbers using array.

It is one of the important program in C based on the Concept of Array. So before proceeding furthur you all must have basic understanding of Array , how array works and all.

1. Program Outline

In this C program to find Sum and Average of 10 numbers using array. First we have to create an array at the beginning of the program then we have to take 10 numbers in our array by the user using for loop as we do in array . Then we do calculations to get our Sum and Average of the inputted numbers , And finally after doing calculations we are ready with our result.

2. Concepts

The main Concept behind this program is Array you’ll be well familiar with Array and its concept to get easy understanding of this program . Certain more Concepts are :-

  1. Array
  2. For loop
  3. Operators

3. Program

Here’s the C Program.

#include<stdio.h>

void main() {


int arr[10];
int i;
float sum=0;
float avg;
 

printf("\n Enter 10 numbers : \n\n");

//taking input by the user
 
 for(i = 0; i<10;i++) {
     
      printf("Enter no. %d   :   \n",i+1);
      scanf("%d",&arr[i]);
      
     
 }
 
 //calculations
 
 for(i = 0; i<10;i++) {
           
         sum = sum + arr[i];   
}
 printf("Sum : %.0f\n",sum);
 
 avg = sum/10;
 
 printf("Average : %.2f",avg);
 

   }

4. Output

After writing our C program let’s check what it gives.

If you find something incorrect or have any questions or feedback please comment down below Thank you.

Similar Posts

Leave a Reply

Your email address will not be published.