package usingscan;
import java.util.Scanner;
public class Bank {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter your first Number : ");
int no1 = sc.nextInt();
System.out.println("Enter your second Number : ");
int no2 = sc.nextInt();
System.out.println("Enter your third Number : ");
int no3 = sc.nextInt();
System.out.println(no1 +no2 +no3);
System.out.println("How would you improve this course?");
String input = sc.nextLine();
System.out.println("Your response:");
System.out.println(input);
sc.close();
System.out.println("Enter your first Number : ");
float no1 = sc.nextFloat();
System.out.println("Enter your second Number : ");
float no2 = sc.nextFloat();
System.out.println("Enter your third Number : ");
float no3 = sc.nextFloat();
System.out.println(no1 +no2 +no3);
}
System.out.println("Enter your mobile Number : ");
long no1 = sc.nextLong();
System.out.println("Enter your mobile Number : ");
long no2 = sc.nextLong();
System.out.println("Enter your mobile Number : ");
long no3 = sc.nextLong();
//System.out.println(no1 +no2 +no3);
}
System.out.println("Enter your first Number : ");
short no1 = sc.nextShort();
System.out.println("Enter your second Number : ");
short no2 = sc.nextShort();
System.out.println("Enter your third Number : ");
short no3 = sc.nextShort();
System.out.println(no1 +no2 +no3);
}
System.out.println("Enter your first Number : ");
double no1 = sc.nextDouble();
System.out.println("Enter your second Number : ");
double no2 = sc.nextDouble();
System.out.println("Enter your third Number : ");
double no3 = sc.nextDouble();
System.out.println(no1 +no2 +no3);
}
System.out.println("Enter your first Number : ");
byte no1 = sc.nextByte();
System.out.println("Enter your second Number : ");
byte no2 = sc.nextByte();
System.out.println("Enter your third Number : ");
byte no3 = sc.nextByte();
System.out.println(no1 +no2 +no3);
}
//boolean
System.out.println("Enter your age: ");
int age = sc.nextInt(); // user input as integer
if (age >= 18) {
System.out.println("You are eligible to vote.");
} else {
System.out.println("You are not eligible to vote.");
}
sc.close();
}
}
Top comments (0)