0% found this document useful (0 votes)
5 views1 page

Java Program to Find Maximum Number

This Java code uses a Scanner to prompt a user to input 4 integer values. It then compares the values to determine the largest number, stores this number in the variable X, and prints out "the mayor is" followed by X. If all 4 numbers are equal, it prints a message to enter different numbers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Java Program to Find Maximum Number

This Java code uses a Scanner to prompt a user to input 4 integer values. It then compares the values to determine the largest number, stores this number in the variable X, and prints out "the mayor is" followed by X. If all 4 numbers are equal, it prints a message to enter different numbers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

programa23.

java

1 import [Link];
2 public class programa23 {
3 public static void main(String[] args) {
4 Scanner sc=new Scanner([Link]);
5 int X;
6 [Link]("Ingresa un numero ");
7 int A = [Link]();
8 [Link]("Ingresa un numero ");
9 int B = [Link]();
10 [Link]("Ingresa un numero ");
11 int C = [Link]();
12 [Link]("Ingresa un numero ");
13 int D = [Link]();
14 if(A == B && A == C && A == D){
15 [Link]("ingrese numeros diferentes");
16 }
17 if(A > B && A > C && A > D){
18 X=A;
19 }else{
20 if(B > A && B > C && B > D){
21 X=B;
22 }else{
23 if(C > A && C > B && C > D){
24 X=C;
25 }else
26 X=D;{
27 [Link]("el mayor es "+X);
28
29 }}}}}

Page 1

You might also like