c program for total amp average in the


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

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: c program for total amp average in the
Reference No:- TGS0159412

Expected delivery within 24 Hours