Professional Documents
Culture Documents
Java Assignment 2
Java Assignment 2
import java.util.Scanner;
public class JavaApplication8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner num = new Scanner(System.in);
System.out.println("enter a number");
int x = num.nextInt();
if(x%2==0)
System.out.println("the number is even ");
else
System.out.println("the number is odd");
// TODO code application logic here
}
ASSIGNMENT 3
import java.util.Scanner;
public class JavaApplication8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner num = new Scanner(System.in);
System.out.println("enter a number");
int x = num.nextInt();
int y = num.nextInt();
int z = num.nextInt();
int SUM ;
SUM = x+y+z;
if(x+y >z || x+z >y || y+z >x)
System.out.println("the input is valid ");
else
ASSIGNMENT 1
import java.util.Iterator;
import java.util.Scanner;
public class JavaApplication8 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(system.in);