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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
find the max of five numbers using C++
+1
vote
asked
Feb 10, 2020
by
anonymous
Please
log in
or register to answer this question.
2 Answers
0
votes
answered
Feb 13, 2020
by
Sirisha
(
140
points)
#include<iostream>
using namespace std;
int main()
{
int a[10]={1,5,2,3,4},i,b;
for(i=0;i<5;i++)
{
if(a[i]>a[i+1])
{
b=a[i];
a[i]=a[i+1];
a[i+1]=b;
}
}
cout<<b;
}
Please
log in
or register to add a comment.
0
votes
answered
Feb 15, 2020
by
Sai Naveen Chowdary
(
140
points)
# include<iostream>
using namespace std;
const int values = 30;
int main ()
{
int num[values];
int max , i;
cout << "Please enter 5 numbers, so that i show you the maximum \n";
cin >> num[0] >>num[1] >>num[2] >> num[3] >>num[4];
max = num[0];
for (int i=0; i<5; i++)
if (max < num[i])
max = num[i];
cout << "The maxmum value is:" << max << endl ;
system ("pause");
return 0;
}
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...