JAVA is dynamic programming language. It is capable of making simple program to complex. We can make simple program of add, even numbers, odd numbers.
First program of adding two numbers in JAVA
Add.java
public class Add { public static void main(String[] args) { int a=5; int b=2; int result=a+b; System.out.print("Additon of a and b :"+result); } }
Second program of subtraction two numbers in JAVA
Subtract.java
public class Subtract { public static void main(String[] args) { int a=5; int b=2; int result=a-b; System.out.print("Subtraction of a and b :"+result); } }
Third program of print even numbers in JAVA
EvenNumber.java
public class EvenNumber { public static void main(String[] args) { for(int i=0;i<=10;i++) { if((i%2)==0) { System.out.println("Even number :"+i); } } } }
Forth program of print odd numbers in JAVA
OddNumber.java
public class OddNumber { public static void main(String[] args) { for(int i=0;i<=10;i++) { if((i%2)!=0) { System.out.println("Odd number :"+i); } } } }
Tags: Programs



Link to Us
u r providing exellent results and a small request from my side is give alternate solutions for a particular task.
thank u
hi all, i have looked in the internet for a count down program in java but never found a simple 1, so i made 1, notice i used kdr.java u can find it on the internet its very usefull. the program is simple using while loop he is the code:
//Program: Count down to Zero
// programmer: Omar Ibrahim
public class CountDown {
public static void main(String args[]) {
int number;
boolean value;
System.out.print(”Input number to count down to zero:”);
number = Keyboard.readInt();
do{
value= true;
number = number -1;
System.out.print(”\n”+number);
kdr.waitsometime(1000);
if (number != 0) {
value = false;
}
}while (!value);
}
}