You can take reference from here.

http://learn.onlinegdb.com/c_program_find_maximum_numbers_from_entered_numbers

0 votes

http://learn.onlinegdb.com/c_program_find_maximum_numbers_from_entered_numbers

0 votes

#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

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

#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);

}

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

#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;

}

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;

}

...