Write a c++ program to find the largest of two numbers.
AnuO9:
sorry using if statement
Answers
Answered by
2
Answer:
Hello there!
#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;
}
There you go man
run this.
Hope this help you!
Answered by
5
Answer:
#include<iostream>
#include<conio.h>
Void main()
{
clrscr();
Int a, b;
cout<<"enter 2 nos";
cin>>a>>b:
if(a>b)
cout<<"largest =<<a;
else
cout<<"largest="<<b;
getch();
}
Explanation:
this is correct answer
Similar questions