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.
#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;
}
Comments
Leave a comment