by Dinesh Thakur Category: C Programming (Pratical)

In this program user ask to find out the average of n Numbers. User declares some variables that are used to contain the value and some elements to be assumed for computation as it is. Like variable N has to be assumed for finding average. While asking about the number quantity user also use While condition to the content. While (count < n) in condition prints the value of x and increment operator for increasing the number. In the end the method to be used for the calculating the average of N number. In the end to display the result in the end.

Problem Statement:
This is c Program that asks the user to find the average of N numbers.

  1. Declaring the Variables.
  2. Using while condition.
  3. Using average calculating method.
  4. Display result on the screen.

Here is C source code for calculating the average of N numbers. The output of this program shown below.

void main( )

      int  n, count = 1;
      float  x, average, sum = 0;
      printf("How many Numbers? " ) ;
      scanf ("%d",&n) ;
      while (count < n)
                  printf ("x = " ) ;
                  scanf("%f", &x);
                  sum += x;
                  average = sum/n;
                  printf("\nThe Average is %f\n", average);

Program to Find the Average of N Numbers

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.