Question in Java : WAP to input heights of two persons.Interchange their heights and print the tallest height.
Answers
Answered by
1
Answer:
Program :
Explanation:
import java.util.*;
class program1()
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a=sc.nextint();
int b=sc.nextInt();
int temp=a;
a=b;
b=temp;
System.out.println("Height of a="+a+" height of b="+b);
System.out.println("Maximum height ="+ (a>b)?a:b );
}
}
Similar questions