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

Assignment Help:

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

 


Related Discussions:- C program for function of average

Write a c program as text layout, Your task in this project is to write a C...

Your task in this project is to write a C program named layout.c which does text layout. This is a staged project, complete the stages in order. The maximum mark if you nish each

Define the processing of a structure, Define the Processing of a Structure?...

Define the Processing of a Structure? The members of structure are typically processed individually as separate entities. So we must be able to access the individual structure

Assyrian keyboard for android, Project Description: I want an app that t...

Project Description: I want an app that the user can download it from the play store and use it as a keyboard for texts and writing. Just like the Samsung keyboard and the arabi

Ascii string related, A string S is said to be "Super ASCII", if it contain...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

What happens while a derived-class object is developed, What happens while ...

What happens while a derived-class object is developed & destroyed? A: Space is allocated (on the heap or the stack) for the full object (i.e. adequate space to store the data m

Describe overloading??, A: Along with the C++ language, you can overload op...

A: Along with the C++ language, you can overload operators and functions. Overloading is the practice of supplying more than one definition for a provided function name in the same

Application for tag in the forest game, Your program should use the Free Pa...

Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zip

Single string programme, write a programme that allows a user to enter 5 di...

write a programme that allows a user to enter 5 distinct words and returns them as a single string

Identifier and constant, What are  Id e n t i f ie rs a n d C o...

What are  Id e n t i f ie rs a n d C o n s t a n ts in C++? Id e n t i f ie r a n d C o n s t a n t : I d e n t i f ie r

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd