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
Project Description: We refurbish older computer and send them back into the market with windows 7 operating system. We are presently using windows deployment services through P

Write a program of constructors and destructors Make a class drugs having encapsulated data for medicine name, whether solid or liquid, price and purpose of use. From this clas

write c language program that shows stack overflow..

pseudo code that will determine if the number is prime or composite

Program is to store all ASCII char into a file: void main()     {   ofstream  fout("ascii.txt");   int i,n=256;   for(i=1;i     {     fout     }

Problem Statement: You have to write a C program to develop a Car Parking Management System for a busy commercial area. The system will record the car plate number, date and time w

Private derivation If no specific derivation is listed, then a private derivation is supposed. If a new class is derived privately from its parent class, then: The priva



Aim: To implement a program to handle stack overflow, underflow and odd number exception using Exception Handling. Code: #include #include #include #define MAX