## Write a Java program to find the largest value among three variables
public class LargestAmongThreeNumbers { public static void main(String[] args) { int num1 = 20; int num2 = 50; int num3 = 55; int largest = num1; if (num2 > largest) { largest = num2; } if (num3 > largest) { largest = num3; } System.out.println("The largest number among " + num1 + ", " + num2 + ", and " + num3 + " is: " + largest); } } |
No comments:
Post a Comment