Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

check if number is odd java

if (num % 2 == 0)
{
	// even number
}
else
{
	// odd number
}
Comment

odd number in java

import java.util.Scanner;

public class Exam{
	public static void main(String[] args){
    
		Scanner scan = new Scanner(System.in);
        System.out.println("Enter number");
		int input = scan.nextInt();
		if(input % 2 != 0){
        	System.out.println(input + " is odd");
	      }
		else
			System.out.println(input + " is even");
	}
}	
Comment

odd numbers in Java

n = 10;
for (int i=0; i<=10; i++){
  System.out.println(2*n+1);
}
Comment

PREVIOUS NEXT
Code Example
Java :: android list[i] 
Java :: get driver mysql 
Java :: Java how to make a number with digits 
Java :: open camera or gallery on button click android 
Java :: add view to relativelayout programmatically 
Java :: how to initialize a set in java 
Java :: frequency of each element from list in java 
Java :: containskey in java 
Java :: getcurrencyinstance java example 
Java :: iterable interface in java 
Java :: java restart while loop 
Java :: counting repeated characters in a string in java 
Java :: How to generate all possible IP addresses based on a given set of digits, in Java? 
Java :: volley dependency 
Java :: int array java 
Java :: java button size 
Java :: java big integer to int 
Java :: copy elements of array in java 
Java :: strictfp java 
Java :: spring scheduled 
Java :: charat(0).touppercase() java 
Java :: how to make a loop in java 
Java :: get minimum of array java 
Java :: runtime intalize array in java 
Java :: matrice java 
Java :: sum of array elements java 
Java :: bean factory vs application context 
Java :: sorting java 
Java :: dot operator java 
Java :: java look and feel system 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =