Minggu, 22 Mei 2011

Summing the data in Array Program

Array is a data type tersetruktur which involves a series of components - componentsthat have the same data type. In an array of many components are fixed.
Array is the systematic arrangement of objects, usually in rows and columns. Inparticular, it may refer to arary one-dimensional.
not add the same amount of arrayy is just bleak right we add a number with anothernumber. The following example program in C + +.

# include <iostream>


int main () {
     int numbers [10];
     int n;
     int count = 0;
     court <<"* Program Summing data in the Array *" <<endl;
     court <<"\ t input of data:";
     cin>> n;


     for (int i = 0; i <n; i + +) {
         court <<"\ t input data to [" <<i +1 <<"]:";
         cin>> numbers [i];
     }


     for (int a = 0; a <n; a + +) {
         total = total + numbers [a];
      }
     court <<endl;
     court <<"\ t sum of all data:" <<amount <<endl;


     return 0;
}

Tidak ada komentar:

Posting Komentar