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

Java Basic Input and Conditionals

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)
19 views2 pages

Java Basic Input and Conditionals

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

import [Link].

Scanner;

public class Main {


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

//question n6
/*
int a= [Link]();
if(a>0) [Link]("Number is positive");
else if(a<0) [Link]("Number is negative");
else [Link]("Number is a zero");
*/
//question n7
/*
char ch= [Link]().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) [Link]("character is a vowel");
else [Link]("character is a consonant");
}
else [Link]("character is a symbol/number");
*/
}
}

You might also like