Accept names of any 2 pupils and their height.display the name of the tallest person
Answers
Answer:
//Assuming it is Java programming
import java.util.*;
public class HtTall{
public static void main (String ar[]){
Scanner sc=new Scanner (System.in);
int a,b; //Height variable
String ab,bc; //Name variable
System.out.println("Enter name and height of 1st person");
int a=sc.nextInt();
String ab=sc.nextLine();
System.out.println("Enter name and height of 1st person");
int b=sc.nextInt();
String bc=sc.nextLine();
if(a>b)
System.out.println("Name:"+ab);
else
System.out.println("Name:"+bc);
}
}
Answer:
//Assuming it is Java programming
import java.util.*;
public class HtTall{
public static void main (String ar[]){
Scanner sc=new Scanner (System.in);
int a,b; //Height variable
String ab,bc; //Name variable
System.out.println("Enter name and height of 1st person");
int a=sc.nextInt();
String ab=sc.nextLine();
System.out.println("Enter name and height of 1st person");
int b=sc.nextInt();
String bc=sc.nextLine();
if(a>b)
System.out.println("Name:"+ab);
else
System.out.println("Name:"+bc);
}
}