Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

c++ three num and max

0 votes
asked Dec 6, 2018 by Maedeh Dehghani (120 points)
the program that gets three numbers and show the max between them

1 Answer

0 votes
answered Dec 7, 2018 by Sivasankar Sivasankar (190 points)
import java.util.Scanner;

class main

{

public static void main(String arg[])

{

Scanner in=new Scanner(Sytem.in);

System.out.println("enter 3 number");

int a=in.nextInt();

int b=in.nextInt();

int c=in.nextInt();

if((a>b)&&(a>c))

{

System.out.println("first number is greater");

}

else if{

System.out.println("second number is greater");

}

else

{System.out.println("Third number is greater");

}

}

}
commented Dec 7, 2018 by Sivasankar Sivasankar (190 points)
else if((b>c)&&(b>a))
commented Dec 12, 2018 by shailesh kumar
import java.util.Scanner;

class greatest_no

{

public static void main(String arg[])

{

Scanner in=new Scanner(Sytem.in);

System.out.println("enter 3 numbers");

int a=in.nextInt();

int b=in.nextInt();

int c=in.nextInt();

if((a>b)&&(a>c))

{

System.out.println("first number is greater");

}

else if(b>a&&b>c)
{

System.out.println("second number is greater");

}

else

{
System.out.println("Third number is greater");

}

}

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...