Follow

Translate

Friday, April 29, 2016

Using One-Dimensional Arrays Of C Programming Language

#define NUMELTS 100
void main(){
  
     int num[NUMELTS ];                        /*   array of numbers     */
    int i;
    int total;                                            /*   sum of the number     */
    float avg;                                         /* average of the number  */
    float diff;                                        /*  number and the average */
   
total = 0;
for(i=0; i<NUMELTS; i++){
/*   read the numbers into the array and add them    */ 
scanf("%d", num[i]);
total +=num[i];   
} /* end for  */ 

avg  = (float)total/NUMELTS;                /* computer the average */
printf("\nnumber difference");      /*    print heading   */
/   * print each number and its difference      */

for(i = 0; i<NUMELTS; i++){
 diff = num[i]-avg;
printf("\n%d%f", num[i], diff);

}   /*  end for  */

printf("\naverage is : %f", avg );
}   /* end main */

Learn More from Blog :  

Expert Web Engineering

Expert Computer Networking

Talent Programming Language C

Logical Discrete Mathematics

Expert Compiler Design

Professional Algorithm Design

Professional Responsive Web Page Design By Bootstrap

Talent Software Engineering
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

0 comments:

Post a Comment