Computer Science, asked by Anonymous, 10 months ago

#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

Answered by nidaeamann
0

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

Answered by AwesomeSoul47
33

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

Similar questions