Computer Science, asked by AnuO9, 3 months ago

Write a c++ program to find the largest of two numbers.​


AnuO9: sorry using if statement

Answers

Answered by Anonymous
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!


AnuO9: bro, can u edit and make it using if statement
AnuO9: hlo
AnuO9: are u there
AnuO9: sorry i forgot to include using if statement
Anonymous: Hello
Anonymous: ok i edit answer
Answered by fazal7
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