Thursday, July 30, 2009

What is the code in C programming that after i enter 10 numbers i can sort get their sum and average?

Please help me solve this problem in C programming. I need the code for a program that when i enter ten numbers, then i could get their sum and average.Thank you so much.

What is the code in C programming that after i enter 10 numbers i can sort get their sum and average?
C
Reply:all you need is an array to store your numbers


then have a loop to do your calculations
Reply:#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


clrscr();


int sum=0, num,avg;


printf("Enter 10 numbers");


for(i=0;i%26lt;=10;i++)


{


scanf("%d",%26amp;num);


sum=sum+num;


}


avg=sum/10;


printf("Sum = %d\nAverage =%d\n",sum,avg);


getch();


}


No comments:

Post a Comment