1.

Accept names of any 2 pupils and their height.display the name of the tallest person in java​

Answer»

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);

}

}

•••♪♪



Discussion

No Comment Found