Sunday, 27 November 2011

C program for Sum of array list with array and calculate avarage.


#include<stdio.h>
#include<conio.h>
void main()
{
 int a[10],i,n,sum=0,avg;
 clrscr();
 printf("Enter the number=");
 scanf("%d",&n);
 i=0;
 while(i<n)
  {
    scanf("%d",& a[i])'
i++;
  }
 i=0;
 while(i<n)
  {
    sum=sum+a[i];
  }
 
 printf("the addition of array list =%d\n",sum);
 avg=sum/n;
 printf("avg=%d",avg);
 getch();

 }

No comments:

Post a Comment