# find the maximum value of 10 inputs

answered Oct 12, 2017 by anonymous
answered Oct 22, 2017 by anonymous
#include <iostream>
using namespace std;

int main()
{
int max, number[10], i;
cout<<"Enter number below"<<endl;
max=0;
for(i=0; i<10; i++)
{
cin>>number[i];
if(number[i]>max)
max=number[i];
}
cout<<"Maximum is: "<<max;
system("pause");
return 0;
}

Using arrays for this kind of problems is useful
commented Oct 22, 2017 by (100 points)
dont works if you ingress only negative numbers
answered Nov 9, 2017 by (300 points)
#include <stdio.h>

int main ()
{
printf("Enter array size\t");
int n;
scanf("%d",&n);

printf ("enter array elements");
int a[n],b[n];
int i, j;
int max;
for (i = 0; i < n; i++)
{
scanf ("%d", &a[i]);
}
max=a[0];
for(i=0;i<n;i++)
{
if(max<a[i])
{
max=a[i];
}
}
printf("maximum=%d",max);

}
+1 vote
answered Nov 9, 2017 by Saeed ur Rehman
#include <iostream>
using namespace std;

int main()
{
int max, number[10];
cout<<"Enter number below"<<endl;
max=number[1];
for(int i=2; i<10; i++)
{
cin>>number[i];
if(number[i]>max)
max=number[i];
}
cout<<"Maximum is: "<<max;
system("pause");
return 0;
}
answered Nov 24, 2017 by anonymous
#include <iostream>

using namespace std;

#define maxValue(a,b) (((a) > (b)) ? (a) : (b))

int main() {

int mValue = 0;

cout <<" In put your numbers "<< endl;

for (int i = 0; i < 10; i++)

{

int num;

cin >> num;

mValue = maxValue(mValue, num);

}

cout << " Teh max value is " << mValue <<endl;

}
```myinputs = []