write a program to input the weight of two boxes in variable weight 1 and weight 2. Find and print the heavier box on the screen
Answers
class series
{
public static void main(double wt1, double wt2)
{
System.out.println(Math.max(wt1,wt2));
}
}
import java.util.*;public class ProgN{ void main() { int w1 = 0, w2 = 0, hw = 0; Scanner sc = new Scanner(System.in);System.out.print("\n Enter the height of the 1st box :"); w1 = sc.nextInt (sc.nextInt());System.out.print("\n Enter the height of the 2nd box :"); w2 = sc.nextInt (sc.nextInt()); hw = (w1 > w2) ? w1 : w2;
import java.util.*;public class ProgN{ void main() { int w1 = 0, w2 = 0, hw = 0; Scanner sc = new Scanner(System.in);System.out.print("\n Enter the height of the 1st box :"); w1 = sc.nextInt (sc.nextInt());System.out.print("\n Enter the height of the 2nd box :"); w2 = sc.nextInt (sc.nextInt()); hw = (w1 > w2) ? w1 : w2;System.out.print("\n Weight of the heavier box is"+hw);
import java.util.*;public class ProgN{ void main() { int w1 = 0, w2 = 0, hw = 0; Scanner sc = new Scanner(System.in);System.out.print("\n Enter the height of the 1st box :"); w1 = sc.nextInt (sc.nextInt());System.out.print("\n Enter the height of the 2nd box :"); w2 = sc.nextInt (sc.nextInt()); hw = (w1 > w2) ? w1 : w2;System.out.print("\n Weight of the heavier box is"+hw); }
import java.util.*;public class ProgN{ void main() { int w1 = 0, w2 = 0, hw = 0; Scanner sc = new Scanner(System.in);System.out.print("\n Enter the height of the 1st box :"); w1 = sc.nextInt (sc.nextInt());System.out.print("\n Enter the height of the 2nd box :"); w2 = sc.nextInt (sc.nextInt()); hw = (w1 > w2) ? w1 : w2;System.out.print("\n Weight of the heavier box is"+hw); }}