C program for total & average in the array , C/C++ Programming

C Program for TOTAL  & AVERAGE IN THE ARRAY 

#include stdio.h>

#include conio.h>

#include string.h>

void main()

{

          int i=0,n[100],limit=0,a=0;

          float b;

          clrscr();

          for(i=0;i<100;i++)

          {

                   n[i]=0;

          }

          printf("\nENTER THE LIMIT OF ELEMENTS: ");

          scanf("%d",&limit);

          for(i=0;i

          {

                   printf("\nENTER THE %d ELEMENT: ",i+1);

                   scanf("%d",&n[i]);

                   a=n[i]+a;

          }

          b=a/i;

          printf("\nTHE TOTAL IS %d",a);

          printf("\nTHE AVG OF ALL NO IS %f",b);

          getch();

}

OUTPUT :

ENTER THE ELEMENTS    : 3

ENTER THE 1 ELEMENTS : 10

ENTER THE 2 ELEMENTS : 10

ENTER THE 3 ELEMENTS : 10 

 

THE TOTAL IS 30

THE AVG. OF ALL ELEMENTS : 10.000

Posted Date: 9/10/2012 7:47:09 AM | Location : United States







Related Discussions:- C program for total & average in the array , Assignment Help, Ask Question on C program for total & average in the array , Get Answer, Expert's Help, C program for total & average in the array Discussions

Write discussion on C program for total & average in the array
Your posts are moderated
Related Questions
Write a function that takes in a radius and evenly covers the screen with circles of that radius. Don't attempt to draw any circles that are completely off the screen.

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

write a c++ program for pebble merchant

Use 16 digit credit card numbers that contain 15 digits an 1 check digit. The format of the card number consists of the 15 digits followed by the check digit. The check digit is co

Blanche has a fashion design company called BLB_Best_Clothing Pty. That she has just opened recently

the problem description. The order of the C Program should be as follows: Variables and constants Use #define statements to define the constants. Use arr

Ask question #write statement that assign random integer to the varaible n in the (100

What are some guidelines / "rules of thumb" for overloading operators? A: Here are a few guidelines / rules of thumb .Use common sense. If your overloaded operator makes life si

Project Description: I have a code that works different on 64 bit and 32 bit system. Code is relative to some crypt functions, similar, but not equal to: I have to move fr

Control structures The control structures appear in both structured programming languages as well as object oriented programming languages.  The three constructs used are: i)