Go to the series : https://browncodeit.blogspot.com/p/java-programs.html
Source Code:
- public class MaxMInimaDemo {
- public static void main(String[] args) {
- try (Scanner input = new Scanner(System.in)) {
- int num1,num2;
- System.out.print("Enter the number: ");
- num1 = input.nextInt();
- System.out.print("Enter the number: ");
- num2 = input.nextInt();
- if(num1 > num2) {
- System.out.print("maximum number is "+num1);
- }
- if(num1<num2){
- System.out.print("maximum number is "+num1);
- }
- }
- }
- }
Output:
Enter the number: 15Enter the number: 19minimum number is 15Enter the number: 59Enter the number: 45maximum number is 59
0 comments:
Post a Comment