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

Java Program to Check Even or Odd Number

This Java code prompts the user to input a floating point number, stores it in the variable x, and then checks if x is even or odd using the modulo (%) operator. It prints out that x is an even number if x % 2 equals 0, and otherwise prints that x is an odd number.

Uploaded by

Lina Salazar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Java Program to Check Even or Odd Number

This Java code prompts the user to input a floating point number, stores it in the variable x, and then checks if x is even or odd using the modulo (%) operator. It prints out that x is an even number if x % 2 equals 0, and otherwise prints that x is an odd number.

Uploaded by

Lina Salazar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import [Link].

Scanner;
public class main {

public static void main(String[] args) {


Scanner entrada = new Scanner([Link]);
[Link]("ingrese un numero entero ");

float x = [Link]();

if( x % 2 == 0) {
[Link]("el numero entero " + x + " es par");
}else {
[Link]("el numero entero " + x + " es impar");
}
}

You might also like