Answer to Question #212588 in C++ for Kefilwe Mamabolo

Question #212588

Write a C++ code that will prompt the user to enter marks of 3 students. Determine and display the lowest mark among the 3. Do not use a loop. 


1
Expert's answer
2021-07-02T04:09:49-0400
#include<iostream>
using namespace std;
int main(){
	
	int first, second, third;
	cout<<"Enter the first element: \t"<<endl;
	cin>>first;
	cout<<"Enter the second element: \t"<<endl;
	cin>>second;
	cout<<"Enter the third element: \t"<<endl;
	cin>>third;
	int lowest = first;
	if(second<first && second< third){
		lowest = second;
	}
	else if(third<first && third<second){
		lowest = third;
	}
	cout<<"The number entered are:\t"<<first<<"\t"<<second<<"\t"<<third<<"\n"<<"The lowest among the number is:\t";
	cout<<lowest;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS