#include <iostream>
using namespace std;
int main()
{
float n1, n2, n3;
cout << "Enter three numbers: ";
cin >> n1 >> n2 >> n3;
if(n1 >= n2 && n1 >= n3)
{
cout << "Largest number: " << n1;
}
if(n2 >= n1 && n2 >= n3)
{
cout << "Largest number: " << n2;
}
if(n3 >= n1 && n3 >= n2) {
cout << "Largest number: " << n3;
}
return 0;
}
Check krna shi hai kya?
@BeardoBoy
Answers
Explanation:
This program is wirtten to determine the largest number out of three numbers.
It starts by taking all the 3 numbers in the form of an input and then compare if first number is larger than 2nd and 3rd number. If yes, mark it as largest and return it at output.
Then compares if 2nd number is larger than 1st and 3rd number. If yes, mark it as largest and return it at output.
Then compares if 3rd number is larger than 1st and 2nd number. If yes, mark it as largest and return it at output.
Finally the program ends
Answer:
Hey mate here is your answer.....
#include <iostream>
include <iostream>using namespace std;
include <iostream>using namespace std;int main()
include <iostream>using namespace std;int main(){
float n1, n2, n3;
cout << "Enter three numbers: ";
cin >> n1 >> n2 >> n3;
if(n1 >= n2 && n1 >= n3)
{
cout << "Largest number: " << n1;
}
if(n2 >= n1 && n2 >= n3)
{
cout << "Largest number: " << n2;
}
if(n3 >= n1 && n3 >= n2) {
cout << "Largest number: " << n3;
}
return 0;
}
hope it's helpful for you.....
thanks