Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

find the maximum value of 10 inputs

+2 votes
asked Oct 11, 2017 by anonymous

6 Answers

0 votes
answered Oct 12, 2017 by anonymous
0 votes
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 Rafael Aparicio (100 points)
dont works if you ingress only negative numbers
0 votes
answered Nov 9, 2017 by sai yaddalapudi (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;
}
0 votes
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;

}
0 votes
answered May 22, 2023 by JINAY KOTHARI (290 points)

The solution for finding maximum out of 10 inputs in below using Python.

myinputs = []
for i in range(1,11):
    x = int(input(f"Enter the Number {i}:"))
    myinputs.append(x)

print("The maximum out of 10 inputs is",max(myinputs))

commented May 22, 2023 by JINAY KOTHARI (290 points)
Sample Comment
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...