0% found this document useful (0 votes)
5 views2 pages

Homework #1

Java homework
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Homework #1

Java homework
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class Main {


public static void main(String[] args) {
//question n1
/*Scanner scanner= new Scanner(System.in);
System.out.println( "input the first integer" );
int a= scanner.nextInt();
System.out.println( "input the second integer" );
int b= scanner.nextInt();
System.out.println( "input the mathematical symbol" );
char c= scanner.next().charAt(0);
if(c=='-') System.out.println(a-b);
if(c=='+') System.out.println(a+b);
if(c=='*') System.out.println(a*b);
if(c=='/') System.out.println(a/b);
if(c=='%') System.out.println(a%b);
*/
//question n2;
/*
int a=scanner.nextInt();
if(a%2==0){
System.out.println("The number is even");
}
else System.out.println("The number is odd");
*/
//question n3
/*
int a= scanner.nextInt();
if(a>=90 && a<=100) System.out.println("A :)");
if(a>=80 && a<=89) System.out.println("B");
if(a>=70 && a<=79) System.out.println("C");
if(a>=60 && a<=69) System.out.println("D");
if(a<60) System.out.println("F :(");
*/
//question n4
/* int a=scanner.nextInt(), b= scanner.nextInt(), c=scanner.nextInt();
if(a>b && a>c) System.out.println(a);
if(b>a && b>c) System.out.println(b);
if(c>b && c>a) System.out.println(c);
*/
//question n5
/*
int year= scanner.nextInt();
if(year%100==0 && year%400!=0) System.out.println("Not a leap year");
else if(year%4==0) System.out.println("Leap year");
*/

//question n6
/*
int a= scanner.nextInt();
if(a>0) System.out.println("Number is positive");
else if(a<0) System.out.println("Number is negative");
else System.out.println("Number is a zero");
*/
//question n7
/*
char ch= scanner.next().charAt(0);
int a= (int)ch;
if((a>=97 && a<=122) || (a>=65 && a<=90)) {
if(a==97 || a==101 || a==105 || a==111 || a==117 || a==65 || a==69 ||
a==73 || a==79 || a==85) System.out.println("character is a vowel");
else System.out.println("character is a consonant");
}
else System.out.println("character is a symbol/number");
*/
}
}

You might also like