Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

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

System.out.println("the input is invalid");

System.err.println("THE PERMITER IS "+SUM);


// TODO code application logic here
}
}

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);

System.out.println("enter a 3 digit number");


int number = input.nextInt();
int d1 = (int)(number/100);
int remaining = number %100;
int d3 = (int)(remaining%10);
System.out.println(number+((d1==d3)?"is a ":"is not a")+ "palindrome");
("the number is not palindrome ");
}
// TODO code application logic here
}

You might also like