- 1
If statement C++
please could someone write down the code for this question: write a c++ program to find the maximim and minimum of 5 numbers (a b c d e) using IF statemnet... i will be glad if u show ur responses..thanks
9 ответов
+ 1
Ok cool, I'll explain in words, then see if you can make that into code.
First, set up a max variable and a min variable.
Then set them both equal to the first number, a.
Then, for each other number:
Check if it is larger than max. If it is, set max equal to it.
Check if it is smaller than min. If it is, set min equal to it.
+ 3
Show us what you already tried. If you haven't tried anything, me holding your hand won't be of any benefit of you.
+ 3
Won't matter since he isn't allowed to use loops. It's simple use of if statements, but I feel like he is just wanting us to do his challenges without him even attempting to solve his problem first. That's why it's only question and no code posted from where he ran into issue.
+ 2
no it is not given in arrays😊
+ 2
#zaqqwerty thank you for the idea, i will try it👍
+ 2
#jojo thank you.
+ 1
int a,b,c,d,e;
cout<<enter ur number<<endl;
cin>>a>>b>>c>>d>>e;
if( a<b<c<d<e<) {
cout<< "the minimum number is"<<a<<endl;
that is my solution but i amn ot sure about it
+ 1
No this won't work...
You should try with 'if' inside 'if' and use a function.
Ask if you want more informations
0
Are the numbers given in an array?