Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java code to print odd number

class JavaExample {
   public static void main(String args[]) {
	int n = 100;
	System.out.print("Odd Numbers from 1 to "+n+" are: ");
	for (int i = 1; i <= n; i++) {
	   if (i % 2 != 0) {
		System.out.print(i + " ");
	   }
	}
   }
}
Comment

PREVIOUS NEXT
Code Example
Java :: android save int 
Java :: check if jcheckbox is checked java 
Java :: how to declare list of object in java as constant 
Java :: how to remove components from a JFRame java 
Java :: java jdk java_home home ubuntu openjdk-8-jdk 
Java :: is prime java 
Java :: How to create a union-find data structure, in Java? 
Java :: fibunacci java 
Java :: unable to find bundled java version. flutter 
Java :: How to convert timestamp to time in android studio 
Java :: java yes or no loop 
Java :: Java Copying Arrays Using copyOfRange() method 
Java :: java.lang.ExceptionInInitializerError: null 
Java :: How to determine if a given binary tree is a binary search tree, in Java? 
Java :: no main manifest attribute java 
Java :: java write 
Java :: setint java 
Java :: java code to print hello world 
Java :: android hide system bar programmatically 
Java :: for each java 
Java :: space in java 
Java :: java infinitew recursion 
Java :: java stream sum integers 
Java :: sorting char array in java 
Java :: export java home 
Java :: collections.reverseorder() in java 
Java :: java ioexception 
Java :: remove spaces at beginning and end of string java 
Java :: arraylist java 
Java :: get last index of array java 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =