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

Padovan string, padovan string for natural numbers program in java /...

padovan string for natural numbers program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class Padov

Sort wars, Explain each of the algorithms in a way that would be understand...

Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

Write a program that computes the cost of a long distance ca, Write a progr...

Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules. a. A call made between 8:00 AM and 6:

Assingment help, can you help with the assignment, I don''t want to upload ...

can you help with the assignment, I don''t want to upload the assignment but want somebody to work with, do you do that?

Define the double data type of c language, Define the Double Data Type of c...

Define the Double Data Type of c Language? The double is used to define BIG floating point numbers and it reserves twice the storage for the number. When the accuracy provided

Random searching, write aprogram for random -search to implement if a[i]=x;...

write aprogram for random -search to implement if a[i]=x;then terminate other wise continue the search by picking new randon inex into a

Static optimality theorem, Question 1 Describe the following with respect ...

Question 1 Describe the following with respect to pointers in C language- Pointers and Arrays Usage of Pointers in functions Write programs in C to demonstrate the

Loop statement, write a c++ program to accept 3 numbers and find the larges...

write a c++ program to accept 3 numbers and find the largest of 3 numbers

Are comments included during compilation stage, Are comments included durin...

Are comments included during compilation stage and placed in EXE file as well? - No, comments encountered by compiler are disregarded. - Their only purpose is ease and guida

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