import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static void main(String[] args) {
// System.out.println("Hello world!");
// Beginning of Else If ||
// ---------------------------------------------------------------------
// Equilateral Triangle = All sides are equal.
// Isoceles Triangle = Any two sides are equal.
// Scalene Triangle = All 3 sides are of different size.
// ----> print the Triangle type as per the input value
// Scanner scn = new Scanner(System.in);
// int a = scn.nextInt();
// int b = scn.nextInt();
// int c = scn.nextInt();
// if(a==b && b==c){
// System.out.println("Equilateral Triangle");
// } else if(a==b || b==c || c==a){
// System.out.println("Isoceles Triangle");
// }else if(a!=c && a!=b && b!=c){
// System.out.println("Scalene Triangle");
// }
// ----> Given 3 no.s, print the maximum number.
// Scanner scn = new Scanner(System.in);
// int a = scn.nextInt();
// int b = scn.nextInt();
// int c = scn.nextInt();
// if(a>=b && a>=c){
// System.out.println("Value of a is greater " + a);
// }else if(b>=c ){
// System.out.println("Value of b is greater " + b);
// } else{
// System.out.println("Value of c is greater " + c);
// }
// ---------------------------------------------------------------------
// Scanner scn = new Scanner(System.in);
// int n = scn.nextInt();
// if(n%3==0 && n%5==0){
// System.out.println("FizzBuzz");
// }else if(n%3==0){
// System.out.println("Fizz");
// }else if (n%5==0){
// System.out.println("Buzz");
// }else {
// System.out.println();
// }
// End of Else If
// ---------------------------------------------------------------------
// Beginning of Nested If
// ---------------------------------------------------------------------
// Q. int a = 10, b = 15;
// if(a > 8) {
// if(a < b || b == 9) {
// System.out.println("Hi");
// }
// else {
// System.out.println("Bye");
// }
// }
// else {
// System.out.println("Good Bye");
// }
// Choose the CORRECT ANSWER
// A- Hi - CORRECT ANSWER
// B- Bye
// C- Good Bye
// D- None
// ---------------------------------------------------------------------
// Q - What will be the output of the given code below:
// int a = 10, b = 15;
// if(a > 8) {
// if(a == b || b < a) {
// System.out.println("Hi");
// }
// else {
// System.out.println("Bye");
// }
// }
// else {
// System.out.println("Got it");
// }
// Choose the Correct Answer
// A - Hi
// B - Bye - CORRECT ANSWER ||
// C - Got it
// D - None
// ---------------------------------------------------------------------
// Scanner scn = new Scanner(System.in);
// int n = scn.nextInt();
// if(n>0){
// if(n%2==0){
// System.out.println(n + " is postive and even");
// }
// else{
// System.out.println(n + " is positive and odd");
// }
// }
// else if(n<0){
// if(n%2==0){
// System.out.println(n + " is negative and even");
// }
// else {
// System.out.println(n + " is negative and odd");
// }
// }
// Assignment
// ---------------------------------------------------------------------
// Problem Description: Q1. Max of three
// Write a program to input three numbers(A, B & C) from user and print the maximum element among A, B & C in each line.
// Problem Constraints
// 1 <= A <= 1000000 || 1 <= B <= 1000000 || 1 <= C <= 1000000
// Input Format : First line is a single integer A. Second line is a single integer B. Third line is a single integer C.
// Output Format: One line containing an integer as per the question.
// Scanner scn = new Scanner(System.in);
// int a = scn.nextInt();
// int b = scn.nextInt();
// int c = scn.nextInt();
// if(a>=b&&a>=c){
// System.out.println(a + " a is greater among a, b & c");
// }else if(b>c){
// System.out.println(b + " b is greater among a, b & c");
// }else {
// System.out.println(c + " c is greater among a, b & c");
// }
// // ---------------------------------------------------------------------
// Q2. Problem Description: Which triangle?
// Write a program to input from user three numbers(A, B & C) representing side lengths of a triangle.
// You have to print if the traingle is "equilateral", "scalene" or "isosceles".
// Input Format: One line containing three space separated integers A, B & C
// Output Format: One string either "equilateral", "scalene" or "isosceles".
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int B = scn.nextInt();
// int C = scn.nextInt();
// if(A==B & B==C){
// System.out.println("equilateral");
// }else if (A==B || B==C|| A==C){
// System.out.println("isosceles");
// } else {
// System.out.println("scalene");
// }
// ---------------------------------------------------------------------
// Q3. Problem Description: Categorise Age Of A Person
// Given age of a person, Categorise it based on age.
// Category is given below :
// if age is in range of 0 to 12 then category is "Child",
// Otherwise if age is in range of 13 to 19 then category is "Teenager",
// Otherwise if age is in range of 20 to 40 then category is "Young",
// Otherwise if age is in range of 41 to 60 then category is "Middle-Aged",
// Otherwise if age is more than 60 than category is "Senior-Citizen"
// Note : Intention of this problem is to give you intuition of if-elseif,
// try to solve this problem using else-if.
// Input Format: Single value denoting age of a person.
// Output Format: According to category of age, print statement in single line.
// ------> CODE BELOW
// Scanner scn = new Scanner(System.in);
// int age = scn.nextInt();
// if(age>60){
// System.out.println("Senior-Citizen");
// }else if(age>=41&&age<=60){
// System.out.println("Middle-Aged");
// }else if(age>=20&&age<=40){
// System.out.println("Young");
// }else if(age>=13&&age<=19){
// System.out.println("Teenager");
// }else{
// System.out.println("Child");
// }
// ---------------------------------------------------------------------
// Problem Description: Q4. Categorise the number - Nested if-else
// Given the number N, Categorise the number according to following condition :
// 1. Odd-Positive
// 2. Odd-Negative
// 3. Even-Positive
// 4. Even-Negative
// Note : Intention of problem is to teach you Nested If-Else, so try to solve this problem using nested if-else
// Input Format: Take Number in single line.
// Output Format: Print the statement, according to number N in single line.
// ------> CODE BELOW:
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// if(N%2==0){
// if(N>0){
// System.out.println("Even-Positive");
// }else{
// System.out.println("Even-Negative");
// }
// }else if(N%2!=0){
// if(N>0){
// System.out.println("Odd-Positive");
// }else{
// System.out.println("Odd-Negative");
// }
// }
// ---------------------------------------------------------------------
// Q5. If Else - 2 MCQ A
// An ELSE statement must be preceded by ___ statement in Java.
// -- IF
// -- ELSE IF
// -- IF or ELSE IF - CORRECT ANSWER
// -- None of the above
// ---------------------------------------------------------------------
// Q6. If Else - 2 MCQ B
// What is the output of the Java program?
// int horses = 10;
// int camels = 5;
// if(horses < 5)
// {
// System.out.println("TOWN");
// }
// else if(horses >=5)
// System.out.print("FOREST ");
// System.out.println("AMAZON");
// else
// System.out.println("UNKNOWN");
// ANSWER BELOW:
// TOWN
// FOREST AMAZON
// UNKNOWN
// Compilation Error - CORRECT ANSWER ||
// ---------------------------------------------------------------------
// Q7. If Else - 2 MCQ C
// What will happen when you compile and run the following code?
// int temperature = 33;
// if(temperature < 0)
// System.out.println("Freezing");
// else if(temperature < 30)
// System.out.println("Pleasant");
// else if(temperature < 50)
// System.out.println("Hot");
// else
// System.out.println("Boiling");
// ANSWER BELOW:
// Pleasant
// Hot - CORRECT ANSWER.
// Hot Boiling
// Compilation Error
// ---------------------------------------------------------------------
// Q8. If Else - 2 MCQ D
// What would be the output of the following code snippet if variable a=10?
// if(a<=0)
// {
// if(a==0){
// System.out.println("1 ");
// }
// else{
// System.out.println("2 ");
// }
// }
// System.out.println("3 ");
// ANSER BELOW:
// a. 1 2
// b. 1 3
// c. 2 3
// d. 3 - CORRECT ANSWER ||
// NOTe: first if condition is false, hence,
// the condition within the first if, for nested if and else would not be executed and the compiler will exit
// and print the independent print statement with output as "3".
// ---------------------------------------------------------------------
// Q9. If Else - 2 MCQ E
// What will be the output of the following program?
// boolean male = false;
// int age = 30;
// if( male ){
// if( age < 20 ){
// System.out.println("Boy");
// }
// else{
// System.out.println("Man");
// }
// }
// else{
// if( age < 20 ){
// System.out.println("Girl");
// }
// else{
// System.out.println("Woman");
// }
// }
// ANSWER BELOW:
// a. Girl
// b. Woman - CORRECT ANSWER. (first if condition is false, therefore if block and its nested if/else would not be executed),
// c. Boy
// d. Man
// ---------------------------------------------------------------------
// Q10. If Else - 2 MCQ F
// What will be the output of the following program?
// int marks = 80;
// if( marks > 70 ){
// System.out.print("Distinction ");
// System.out.print("Congratulations ");
// }else if( marks > 35 ){
// System.out.print("Pass ");
// }else
// System.out.print("Fail ");
// System.out.println("Better luck next time");
// CHOOSE ANSWER FROM BELOW:
// Distinction Congratulations
// Pass
// Fail Better luck next time
// Distinction Congratulations Better luck next time - - CORRECT ANSWER ||
// ---------------------------------------------------------------------
// Q11. If Else - 2 MCQ G
// What is the final value of grade when the following code executes and the score is 80?
// if (score >= 90) grade = "A";
// if (score >= 80) grade = "B";
// if (score >= 70) grade = "C";
// if (score >= 60) grade = "D";
// else grade = "E";
// 1. A
// 2. B
// 3. C
// 4. D
// 5. E
// int score = 80;
// if (score >= 90){
// System.out.println("grade A");
// }else if (score >= 80){
// System.out.println("grade B");
// }if (score >= 70){
// System.out.println("grade C");
// }if (score >= 60){
// System.out.println("grade D");
// } else {
// System.out.println("grade E");
// }
// ---------------------------------------------------------------------
// Q12. If Else - 2 MCQ H
// State TRUE or FALSE:
// “An ELSE or ELSE-IF statement in Java can not exist alone without an IF statement.”
// ANSWER BELOW:
// TRUE - CORRECT ANSWER.
// FALSE
// ---------------------------------------------------------------------
// Q13. If Else - 2 MCQ I
// What will be the output of the following code?
// int x = 15;
// if(x > 10){
// x++;
// if(x == 16){
// System.out.println(“UPDATED”);
// }else if(x == 15){
// System.out.println(“NO CHANGE”);
// }
// }else{
// System.out.println(“YES”);
// }
// CHOOSE THE ANSWER BELOW:
// UPDATED - CORRECT ANSWER ||
// NO CHANGE
// YES
// Compilation Error
// ---------------------------------------------------------------------
// Q14. If Else - 3 MCQ A
// What will be printed if x=3, y=5, z=2:
// if (x < y && x < z){
// System.out.println("a");
// }
// else if ( y < x && y < z){
// System.out.println("b");
// }
// else{
// System.out.println("c");
// }
// 1. a
// 2. c - CORRECT ANSWER ||
// 3. b
// 4. Compilation Error
// ---------------------------------------------------------------------
// Q15. If Else - 3 MCQ B
// Which of the following conditions is correct for marriage age validation?
// if(gender == "M" && age > 21){
// }
// else if(gender == "F" && age > 18){
// }
// if(gender == "M" && age >= 21){
// }
// else if(gender == "F" && age >= 18){
// }
// if(gender == "M" || age >= 21){
// }
// else if(gender == "F" || age >= 18){
// }
// if(gender == "M" && age == 21){
// }
// else if(gender == "F" && age == 18){
// }
// Note - Assume valid marriage is >= 18 for females and >= 21 for males
// a. 1
// b. 2 - CORRECT ANSWER ||
// c. 3
// d. 4
// ---------------------------------------------------------------------
// Q16. If Else - 3 MCQ C
// What is the output of the following code?
// if(4+5 == 10){
// System.out.print("True ");
// }
// else{
// System.out.print("False ");
// }
// System.out.print("True");
// CHOOSE ANSWER FROM BELOW:
// True
// True False
// False True - CORRECT ANSWER ||
// True True
// ---------------------------------------------------------------------
// Q17. If Else - 3 MCQ E
// What is the output of the following code?
// public class ScopeOfVariables{
// public static void main(String[ ] args){
// int x = 10;
// int y = 20;
// {
// System.out.print(x + ", " + y);
// }
// {
// System.out.print(" - " + x + ", " + y);
// }
// System.out.print(" - " + x + ", " + y);
// }
// }
// 1. Compilation Error
// 2. 10, 20 - 10, 20 - 10, 20 - CORRECT ANSWER ||
// 3. Runtime Error
// ---------------------------------------------------------------------
// Q18. Problem Description: Fizz Buzz
// Write a program that takes in a number N as input and does the following:
// if N is a multiple of 3, print Fizz
// if N is a multiple of 5, print Buzz
// if N is a multiple of both 3 and 5, print FizzBuzz
// Input Format: There is only 1 single line in the input, which is the integer N.
// Output Format: Print Fizz / Buzz / FizzBuzz depending on the value N.
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// if(N%3==0 && N%5==0){
// System.out.println("FizzBuzz");
// }else if(N%5==0&&N%3!=0){
// System.out.println("Buzz");
// }else{
// System.out.println("Fizz");
// }
// ----> END OF ASSIGNMENT ||
//--------------------------------------------xxxx---------------------------------------//
// BEGINNING OF ADDITIONAL PROBLEMS ||
// ---------------------------------------------------------------------
// Q1. Problem Description: Marking System
// Given marks of a student M, if his/her marks >= 50 then the student has passed the exam otherwise failed.
// If a student passes the exam, print PASS and also the grade of student, grading system -
// Marks are between [50,80] -> B
// Marks are between [81,100] -> A
// But if the student fails the exam, then print FAIL.
// Input Format: M means marks of student
// Output Format: Print PASS and Grade, if the student passes the exam otherwise print FAIL.
// Scanner scn = new Scanner(System.in);
// int marks = scn.nextInt();
// if(marks>=1&&marks<=100){
// if(marks>80&&marks<=100){
// System.out.println("PASS " + "A");
// }else if(marks>=50&&marks<=80){
// System.out.println("PASS " + "B");
// }
// }
// else if(marks<50){
// System.out.println("FAIL");
// }
// ---------------------------------------------------------------------
// Q2. Problem Description: Which Month?
// Write a program to input an integer(A) from user and print the Ath month of the year.
// Months list: {January, February, March, April, May, June, July, August, September, October, November, December}
// Problem Constraints: 1 <= A <= 12
// Input Format: One line containing an integer integer A.
// Output Format: One line containing the Ath month of the year.
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// if (A >=1 && A<=12) {
// if (A==1) {
// System.out.println("January");
// }
// else if (A==2) {
// System.out.println("February");
// }
// else if (A==3) {
// System.out.println("March");
// }
// else if (A==4) {
// System.out.println("April");
// }
// else if(A==5) {
// System.out.println("May");
// }
// else if(A==6) {
// System.out.println("June");
// }
// else if (A==7) {
// System.out.println("July");
// }
// else if (A==8) {
// System.out.println("August");
// }
// else if (A==9) {
// System.out.println("September");
// }
// else if (A==10) {
// System.out.println("October");
// }
// else if (A==11) {
// System.out.println("November");
// }
// else {
// System.out.println("December");
// }
// }
// ---------------------------------------------------------------------
// Q3. Problem Description: Coding Rating
// Write a program to input from user an integer(n) representing the rating of a person on a platform.
// You have to print the category of that person.
// If the rating is greater than or equal to 2100 then that person is "grand master".
// If the rating is greater than or equal to 1900 then that person is "candidate master".
// If the rating is greater than or equal to 1600 then that person is "expert".
// If the rating is greater than or equal to 1400 then that person is "pupil".
// If the rating is smaller than 1400 then that person is "newbie".
// NOTE: Print all the chars of the category of the person in lowercase if rating is odd otherwise print in UPPERCASE
// Problem Constraints: 1000 <= n <= 2500
// Input Format: One line containing an integer n.
// Output Format: A string representing the category of the person.
// Scanner scn = new Scanner(System.in);
// int n = scn.nextInt();
// if(n>=1000&&n<=2500){
// if(n%2==0){
// if(n>=2100){
// System.out.println("GRAND MASTER");
// }
// else if(n>=1900&&n<2100){
// System.out.println("CANDIDATE MASTER");
// }else if(n>=1600&&n<1900){
// System.out.println("EXPERT");
// }
// else if(n>=1400&&n<1600){
// System.out.println("PUPIL");
// }
// else{System.out.println("NEWBIE");
// }
// }
// else if (n%2!=0){
// if(n>=2100){
// System.out.println("grand master");
// }
// else if(n>=1900&&n<2100){
// System.out.println("candidate master");
// }else if(n>=1600&&n<1900){
// System.out.println("expert");
// }
// else if(n>=1400&&n<1600){
// System.out.println("pupil");
// }
// else{System.out.println("newbie");
// }
// }
// }
// ---------------------------------------------------------------------
// Q4. Problem Description: Nested If Else Coding-
// - Write a program that asks the user to input a number N. If N is between 10 and 20, your program should ask
// the user to enter another number M and then Print the sum of the two numbers.
// - If the sum is greater than equal to 100, your program should also print "That is a large sum!" on a new line.
// - If N is not between 10 and 20, your program should print -1.
// Problem Constraints
// 1 <= N <= 100
// 1 <= M <= 100
// Input Format
// The first line in the input is an integer N.
// If N is between 10 and 20 (both included), then the second line is there in the input containing another integer M.
// Output Format
// - If N is not between 10 and 20, then output -1.
// - If N is between 10 and 20, the first line of the output contains N + M.
// - If N + M is greater than or equal to 100, the second line of the output contains That is a large sum!
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// if(N>=10&&N<=20){
// int M = scn.nextInt();
// int sum= N + M;
// System.out.println(sum);
// if(sum>=100){
// System.out.println("That is a large sum!");
// }
// }
// else {
// System.out.println("-1");
// }
// ---------------------------------------------------------------------
// Q5. Problem Description: Days In Month
// You are given an integer A.
// You have to tell how many days are there in the month denoted by A in a non-leap year.
// Months are denoted as follows:
// January : 1
// February : 2
// March : 3
// April : 4
// May : 5
// June : 6
// July : 7
// August : 8
// September : 9
// October : 10
// November : 11
// December : 12
// Problem Constraints
// 1 <= A <= 12
// Input Format: The input contains a single integer A.
// Output Format: Print a single integer denoting the number of days on a single line.
// Scanner scn = new Scanner(System.in);
// int a = scn.nextInt();
// if(a>=1&&a<=12){
// if (a==1||a==3||a==5||a==7||a==8||a==10||a==12){
// System.out.println("31");
// }else if(a==4||a==6||a==9||a==11){
// System.out.println("30");
// }else{
// System.out.println("28");
// }
// }
// ---------------------------------------------------------------------
// Q6. Problem Description: Percentage and Grade
// Write a program to calculate the percentage (according to marks of a student) and grade
// (according to the percentage of a student). Five numbers(A, B, C, D & E) represent the marks of a student in 5 subjects which are out of 100.
// Print the percentage and the grade of the student.
// If percentage >= 90% : Grade A
// If percentage >= 80% but <90 : Grade B
// If percentage >= 70% but <80: Grade C
// If percentage >= 60% but <70: Grade D
// If percentage >= 40% but <60: Grade E
// If percentage < 40%: Grade F
// NOTE: You have to take the lowest integer of the percentage. E.g. 90.8% will be treated as 90%.
// Input Format: There will be five lines of inputs as following:
// The five lines contain the 5 subject marks of the student in numerical format.
// Output Format: The first line indicates the percentage in integer format.
// The next line displays the grade in string format.
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int B = scn.nextInt();
// int C = scn.nextInt();
// int D = scn.nextInt();
// int E = scn.nextInt();
// int sum=A+B+C+D+E;
// int T=100;
// int P=(sum*T/500);
// if(P>=90){
// System.out.println(P);
// System.out.println("A");
// }else if(P>=80&&P<90){
// System.out.println(P);
// System.out.println("B");
// }else if(P>=70&&P<80){
// System.out.println(P);
// System.out.println("C");
// }else if(P>=60&&P<70){
// System.out.println(P);
// System.out.println("D");
// }else if(P>=40&&P<60){
// System.out.println(P);
// System.out.println("E");
// }else {
// System.out.println(P);
// System.out.println("F");
// }
// ---------------------------------------------------------------------
// // Q7. Problem Description: Confusion In Electricity Bill
// // Mr. T got the Electricity bill of his house. He felt that the bill amount was too much.
// He come to you to understand the relation between amount and number of units with Electricity bill.
// // Instructions are give on Electricity biil that :
// // 1. For first 50 units Rs. 0.50/unit.
// // 2. For next 100 units Rs. 0.75/unit.
// // 3. For next 100 units Rs. 1.20/unit.
// // 4. For above 250 units Rs. 1.50/unit.
// // 5. An additional surcharge of 20% is added to the bill.
// NOTE: As the electricity bill can have any real value (floating point),
// you have to tell the Integral value of the bill. For eg. Integral value of 2.91 is 2.
// To avoid manual calculation again and again, You have to write a code which take number
// of Unit (suppose N) from user and print the amount.
// Problem Constraints: 0 < N <= 100000
// Input Format: Take an integer N from user50
// Output Format: Print the amount for that much unit
// SOLUTION ---->
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// double bill = 0.0;
// int amount = (int)bill;
// if (N<=100000){
// if (N<=50){
// bill = N*(0.50);
// } else if (N>50&&N<=150){
// bill= 50*(0.50) + (N-50)*(0.75);
// } else if (N>150&&N<=250){
// bill = 50*(0.50) + (100*(0.75)) + (N-150)*(1.20);
// } else if (N>250){
// bill = (50*(0.50)) + (100*(0.75)) + ((100)*(1.20)) + ((N-250)*(1.50));
// }
// amount = (int)(bill + (bill*(0.2)));
// System.out.println(amount);
// }
// ---------------------------------------------------------------------
// Q8. Problem Description: Pac-man ?
// In this exercise, you need to implement some rules from Pac-Man, the classic 1980s-era arcade-game.
// You have to answer whether the Pac-Man loses or not.
// Your are given the following integer inputs (0 / 1) one in each line:
// 1. Does the Pac-Man have a power pellect active?
// 2. Is the Pac-Man touching a ghost?
// The Pac-Man loses if it is touching a ghost and does not have a power pellet active.
// Input Format: There are 2 lines in the input.
// The first line indicates if the Pac-Man has a power pellet active (1 for yes, 0 for no)
// The second line indicates if the Pac-Man is touching a ghost (1 for yes, 0 for no)
// Output Format: Print 1 if the Pac-Man loses else 0.
// SOLUTION ------>
// Scanner scn = new Scanner(System.in);
// int pallet = scn.nextInt(); // 1 - (yes-active) / 0 - (no-not active)
// int ghost = scn.nextInt(); // 1 - (yes-Touching Ghost) / 0 - (no-not touching)
// if(pallet==0&&ghost==0){
// System.out.println("0");
// } else if(pallet==0&&ghost==1){
// System.out.println("1");
// } else if(pallet==1&&ghost==0){
// System.out.println("0");
// }else if(pallet==1&&ghost==1){
// System.out.println("0");
// }
// ---------------------------------------------------------------------
// Q9. Problem Description: Music Certification
// A programmer for a music company is developing a program to determine the highest level of certification for an album.
// The program needs to follow this table of thresholds for each certification level:
// Minimum albums sold Certification
// 500000 (5*105) gold
// 1000000 (106) platinum
// 10000000 (107) diamond
// Given the albums sold(N) as input, print the certification for the album.
// If no certification, print None.
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// if(N<=1000000000){
// if(N>500000&&N<=1000000){
// System.out.println("Gold");
// }else if (N>1000000&&N<=10000000){
// System.out.println("platinum");
// }else if (N>10000000){
// System.out.println("diamond");
// }
// else{
// System.out.println("None");
// }
// }
// ---------------------------------------------------------------------
// Q10. Problem Description: Bank Account
// You are given a Bank account having N amount and you are asked to perform ADD(credit) or SUBTRACT(debit) operation of an amount X.
// After the operation print the amount left in the Bank account.
// If the debit amount is greater than current balance print "Insufficient Funds"(without quotes) and the operation is skipped.
// Problem Constraints: 1 <= N, X <= 105
// Input Format: First line contains a single integer N denoting the balance in bank account.
// Next line contains two space separated integers Type and Amount(X).
// If Type == 1, Perform ADD operation.
// If Type == 2, Perform SUBTRACT operation.
// Output Format: Print Amount in the bank balance after the operation.
// Scanner scn = new Scanner(System.in);
// int Accbal = scn.nextInt();
// int addsub = scn.nextInt();
// int Amount = scn.nextInt();
// if(addsub>0&&addsub<=2){
// if(addsub==1){
// System.out.println(Accbal + Amount);
// }
// else if(addsub==2){
// if(Accbal>=Amount){
// System.out.println(Accbal - Amount);
// }else {
// System.out.println("Insufficient Funds");
// }
// }
// }
// ---------------------------------------------------------------------
// Q11. Problem Description: Leap Year III
// Given an integer A representing an year, Return 1 if it is a leap year else return 0.
// A year is leap year if the following conditions are satisfied:
// Year is multiple of 400.
// Else the year is multiple of 4 and not multiple of 100.
// Problem Constraints: 1 <= A <= 109
// Input Format: First and only argument is an integer A
// Output Format: Return 1 if it is a leap year else return 0
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// if(A%4==0){
// System.out.println("1");
// }
// else{
// System.out.println("0");
// }
// ---------------------------------------------------------------------
// Q12. Problem Description: Find Largest of Three
// Mr. ST is playing a game. There is a buket and it have 3 slips.
// Target is that you have to check all the slips and show him the slip with max number.
// Problem Constraints
// -1000000 <= N1, N2, & N3 <= 1000000
// Input Format First line : N1 Integer || Second line : N2 Integer || Third line : N3 Integer
// Output Format: Print Largest number between N1, N2 and N3
// i.e. if num is largest then print "num is largest number".
// Scanner scn = new Scanner(System.in);
// int N1 = scn.nextInt();
// int N2 = scn.nextInt();
// int N3 = scn.nextInt();
// if(N1>=N2&&N1>=N3){
// System.out.println(N1 + " is largest number");
// }else if(N2>=N3){
// System.out.println(N2 + " is largest number");
// }else {
// System.out.println(N3 + " is largest number");
// }
// ---------------------------------------------------------------------
// Q13. If Else - 3 MCQ L
// What is meant by dry running code ?
// Run code on compiler
// Run code on computer
// Run code with pen and paper - CORRECT ANSWER |
// Run code with Java
// ---------------------------------------------------------------------
// Q14. If Else - 3 MCQ F
// What will be the output of the following code?
// int x = 10;
// int y = 20;
// {
// y = 25;
// System.out.print(x + "," + y);
// }
// {
// System.out.print(" - " + x + ", " + y);
// }
// System.out.print(" - " + x + ", " + y);
// SELECT ANSWER FROM BELOW:
// 10, 25 - 10, 20 - 10, 20
// 10, 25 - 10, 25 - 10, 25 - CORRECT ANSWER ||
// 10, 25 - 10, 25 - 10, 20
// Compilation Error
// ---------------------------------------------------------------------
// Q15. If Else - 3 MCQ G
// What is the output of the following code?
// public class ScopeOfVariables{
// public static void main(String[ ] args){
// int x = 10;
// int y = 20;
// {
// y = 15;
// System.out.print(x + “, “ + y);
// }
// {
// x = 15;
// System.out.print(“ - “ + x + “, “ + y);
// }
// System.out.print(“ - “ + x + “, “ + y);
// }
// }
// ANSWER FROM THE BELOW SOLUTIONS:
// 10, 15 - 15, 15 - 15, 20
// 10, 15 - 15, 15 - 15, 25
// 10,15 -15,15 -15,15 - CORRECT ANSWER ||
// Compilation Error
// ---------------------------------------------------------------------
// Q16. If Else - 3 MCQ H
// What will be the output of the following code?
// public class ScopeOfVariables{
// public static void main(String[ ] args){
// int x = 10;
// int y = 20;
// {
// System.out.print(x + “, “ + y);
// }
// {
// x = 15;
// System.out.print(“ - “ + x + “, “ + y);
// }
// System.out.print(“ - “ + x + “, “ + y);
// }
// }
// ANSWER FROM THE BELOW SOLUTIONS:
// 10, 20 - 15, 20 - 15, 20 - CORRECT ANSWER ||
// 10, 20 - 15, 20 - 10, 20
// Compilation Error
// Runtime Error
// ---------------------------------------------------------------------
// Q17. If Else - 3 MCQ I
// What will be the output of the following code?
// public class ScopeOfVariables{
// public static void main(String[ ] args){
// int x = 10;
// {
// int y = 20;
// System.out.print(x + ", " + y);
// }
// {
// int y = 10;
// x = 15;
// System.out.print(" - " + x + ", " + y);
// }
// System.out.print(" - " + x + ", " + y);
// }
// }
// ANSWER FROM BELOW SOLUTIONS:
// 10, 20 -15, 10 -15, 10
// 10, 20 - 15, 20 - 10, 20
// 10, 20 - 15, 20 - 15, 20
// Compilation Error - CORRECT ANSWER || VARIABLES ARE Y IS NOT DEFINED AND IS ALSO NOT ACCESSIBLE AT LINE 1105 ||
// Runtime Error
// ---------------------------------------------------------------------
// Q18. If Else - 3 MCQ J
// What will be the output of the following code?
// public class LifeTime{
// public static void main(String[ ] args){
// if(true){
// int x = 10;
// System.out.print("Value of X = " + x);
// x++;
// }
// System.out.print("Value of X = " + x);
// }
// }
// ANSWER FROM THE BELOW SOLUTIONS:
// Value of X = 10 Value of X = 11
// Value of X = 10 Value of X = 0
// Value of X = 10 Value of X = 10
// Compilation Error - CORRECT ANSWER - VARIABLE X IS NEITHER DEFINED NOR ACCESSIBLE AT LINE 1127 ||
// ---------------------------------------------------------------------
// Q19. If Else - 3 MCQ K
// What will be the output of the following code?
// public class scope{
// public static void main(String[ ] args){
int a = 0;
{
int b = 10;
System.out.print("b = " + b);
int c = b + a;
System.out.print(", c = " + b);
}
a = c + b;
System.out.print(", a = " + a);
// }
// }
// b = 10, c = 10, a = 20
//
// ANSWER FROM THE SOLUTIONS BELOW:
// a = 20, b = 10, c = 10
// b = 10, c = 20, a = 10
// b = 10, c = 10, a = 20
// Compilation Error - CORRECT ANSWER || Variable a is re-assigned as value of variable (c + b), however, both c & b are not declared.
// Runtime Error
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: