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
how would land elevation have changed if Coronado had traveled 150 miles due west from what is today Arizona instead of east toward New Mexico

I want source code for class booking system by using C++ Programming...Urgent

in mobiles mumbers to alphabets

We need an E Commerce site likefifacointrader. you must have experience with that kind of work You have to show a sample of work like that site. Skills required are C Prog

You may work in pairs for this assignment. Submit only one project per team; both partners will receive the same grade. Also, you can earn up to 40 points (out of 25) on this assig

How does an ERP System facilitates better decision making?

Program is to search for a given character in a string: Program is to search for a given character in a string and print point of match char *stsearch(char *string, char sea

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Access to the channel/devices is achieved by means of general purpose I/O routines Theses are standard functions described in stdio.h header file namely getc and putc. Getc and put

for different operation multiple stack