Question #48656

how to print ten no and how to find max among them

Expert's answer

/* Answer on Question#48656 - Subject - Programming, C++ */
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int i, j,S; //index
int a[9];
bool *mas; //bool array

cout << "Enter 10 numbers: \n";
for ( i=0; i<=9; i++)
cin >> a[i];

//print numbers
cout << "Entered numbers are: ";
for ( i=0; i<=9; i++ )
cout << a[i] <<" ";
// search for max number

int max = a[0];
for ( i = 1; i < 9; i++ )
if (a[i] > max)
max = a[i];
cout <<endl<<"Max number is: "<<max<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}

LATEST TUTORIALS
APPROVED BY CLIENTS