Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Odd or even program in java using a mod operator

import java.util.Scanner;public class Main{public static void main(String[] args){Scanner reader = new Scanner(System.in);System.out.print("Enter a number: ");int num = reader.nextInt();if(num % 2 == 0)System.out.println(num + " is even");elseSystem.out.println(num + " is odd");}}
Comment

PREVIOUS NEXT
Code Example
Java :: Data provider using junit 
Java :: get host from request object java 
Java :: java foreach letter in word 
Java :: java binary search 
Java :: reader from string java 
Java :: Unexpected end of file in android studio activity main.xml 
Java :: how to copy an object in java 
Java :: draw triangle in android studio xml 
Java :: java.lang.double cannot be cast to java.lang.float 
Java :: JFrame change border 
Java :: java regex for ip address 
Java :: java string stringbuilder array list tostring 
Java :: java zahlen runden auf 1 nachkommastelle 
Java :: java.lang.NoClassDefFoundError 
Java :: difference between two sets java 
Java :: javaparser 
Java :: change fab image programatically 
Java :: java list of lists 
Java :: Simple For Loop Java Example 
Java :: what is a float java 
Java :: java 2d jagged array example 
Java :: java check array for duplicates 
Java :: Java long Keyword 
Java :: down casting java 
Java :: input arraylist in java 
Java :: transformer une chaine de caractère en nombre java 
Java :: islowercase java 
Java :: loops in java 
Java :: loop and save letters in a string java 
Java :: swap two nodes of a linked list 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =