Pages

Monday, November 4, 2013

array

#include<iostream>

using namespace std;

int main()

{

    int i;
    int score[10]={4,1,5,3,4,10,9,2,1,7};
    int max = score[0];
    int min = score[0];
    
    for ( i = 0 ; i < 10 ; i++ )
{
        
    if (score[i] > max)
        max = score[i];
        
        else if (score[i] < min)
            min = score[i];
}
    cout <<"\n maximun of umber is"<<max;
    cout <<"\n minimun of number is"<<min;
    
    system("PAUSE");
    return 0;

}

No comments:

Post a Comment