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

Assignment Help:

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


Related Discussions:- C program for total & average in the array

New customer, #questionhow can i add new customer and alot him a new unique...

#questionhow can i add new customer and alot him a new unique id ..

Basic C++ Velocity and Momentum Program, Write a program that does the foll...

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

What is buddy systems, Buddy systems : A method of handling the storage man...

Buddy systems : A method of handling the storage management problem is kept individual free lists for blocks of dissimilar sizes. Every list having free blocks of only one particul

When should you employ multiple inheritance?, Q: When should you employ mul...

Q: When should you employ multiple inheritance? A:There  are  three  acceptable  answers:-  "Rarely," "Never," and  "while  the  problem  domain cannot be modeled accurately any

Area under curve, write a program to find the area under curve y=f(x) betwe...

write a program to find the area under curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits a and b

Area under curve. , Write a program to find the area under the curve y = f(...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Selection sort, Selection Sort using this a nested for loop to iterate thro...

Selection Sort using this a nested for loop to iterate through and compare the array elements. If the value of an element with lower index is greater than the value of an element w

#pointers, what is the purpose of pointer ? what is the syntax? how it work...

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

Computer Science 101, This is what I need help with. "Create a program cre...

This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

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