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
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


A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Mixed Mode Expressions and Implicit type Conversions A mixed mode expression is one in which the operands are not of the similar type. In this case, the operands are converted

What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than a

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

what is the purpose of pointer ? what is the syntax? how it works?



Q: But MFC appear to encourage the employ of catch-by-pointer; should I do the similar? A: Depends. If you're utilizing MFC and catching one of their exceptions, by all means, d