C program for function of average, C/C++ Programming

C program for function  of average

int average(int);

void main()

{

          int max=0,c=0;

          clrscr();

          printf("ENTER THE LIMIT OF INPUT FOR AVERAGE: ");

          scanf("%d",&max);

          c=average(max);

          printf("THE AVERAGE OF %d DIGIT IS %d",max,c);

          getch();

}

int average(int i)

{

          int j=0,n=0,sum=0;

          for(j=1;j<=i;j++)

          {

                   printf("ENTER THE DIGIT: ");

 

                   scanf("%d",&n);

                   sum=sum+n;

          }

          sum=sum/i;

          return(sum);

}

 

OUTPUT :

ENTER THE LIMIT OF INPUT FOR AVG : 5

ENTER THE DIGIT: 5

ENTER THE DIGIT : 10

ENTER THE DIGIT : 15

ENTER THE DIGIT : 20

ENTER THE DIGIT : 10

THE AVERAGE OF 5 DIGIT IS 12

 

Posted Date: 9/10/2012 8:05:46 AM | Location : United States







Related Discussions:- C program for function of average, Assignment Help, Ask Question on C program for function of average, Get Answer, Expert's Help, C program for function of average Discussions

Write discussion on C program for function of average
Your posts are moderated
Related Questions
application problem of tower of hanoi

Project Description: 1) Develop banking software 2) Payment Gateway System There is some other system available for development. I'm willing to show long-term opportunity

.Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Simpson's Rule is a more accurate method of numerical integration than the method described in class. Using Simpson's Rule, the integral of a function f between a and b is approxim

A: No. Syntax wise it is permitted. But then the function is no longer Inline. Since the compiler will never know how deep the recursion is at compilation time.

Problem: (a) (i) What is a structure? (ii) How does a structure differ from an array? (b) Declare a structure, called account, that will contain the following data me

I need to make a fractal trees in OpenGL C++ . The method used is to write a recursive function with cylinders of different sizes and angles to create the tree trunk and branches.

Purpose For this assignment you will need to create either a function list or a record series for a CRCRS. Instructions Note: Complete only one of the two assignment op

Define Polymorphism? A: Polymorphism let a client to treat di_erent objects in the simialr way even if they were developed from di_erent classes and exhibit di_erent behaviors.