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!");
// ----------------------------------------------------------------------------------------------------------------
// Q1. Problem Description: From top to down
// Write a program that takes a positive integer N as input from the user and prints all natural numbers from 1 to N,
// with each number followed by a space (including the last number).
// Problem Constraints: 1 <= N <= 1000000
// Input Format: A single line representing N
// Output Format: N space separated integers from 1 to N, with each number followed by a space, including the last number.
// Example Input
// Input 1: 5
// Input 2: 10
// Example Output
// Output 1: 1 2 3 4 5
// Output 2: 1 2 3 4 5 6 7 8 9 10
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// int i = 1;
// if(N>=1&N<=1000000){
// while(i<=N){
// System.out.print(i + " ");
// i++;
// }
// }
// ----------------------------------------------------------------------------------------------------------------
// Q2. Problem Description: Odd Game ?
// Write a program to print all odd numbers from 1 to N where you have to take N as input from user. Here N is inclusive.
// Note: Each number should be followed by a space, including the last number.
// Problem Constraints: 1 <= N <= 2000000
// Input Format: A single line representing N
// Output Format: All odd numbers from 1 to N, each number followed by a space, including the last number.
// Example Input Input 1: 5 || Input 2: 10 ||
// Example Output Output 1: 1 3 5 || Output 2: 1 3 5 7 9 ||
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// int i = 1;
// if(N>=1&N<=2000000){
// while(i<=N){
// if(i%2!=0){
// System.out.print(i + " ");
// }i+=1;
// }
// }
// ----------------------------------------------------------------------------------------------------------------
// Q3. Problem Description: Print in Range
// Given two numbers, A and B, your task is to print all the numbers in the range from A to B (both inclusive),
// with each number followed by a space, including the last number.
// Note : Try to solve this question using a while loop for learning purposes.
// Problem Constraints: 0 <= A <= B <= 500
// Input Format First line denotes the value of A || Second line denotes the value of B
// Output Format: Print the number from A to B(both inclusive), with each number followed by a space, including the last number.
// Example Input A-5 B-9 || Example Output : 5 6 7 8 9
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int B = scn.nextInt();
// int i=A;
// if((A>=0&&A<=500)& (B>A&&B<=500)){
// while(i<=B){
// System.out.print(i + " ");
// i+=1;
// }
// }
// ----------------------------------------------------------------------------------------------------------------
// Q4. Problem Description: Sum the digits ?
// You take a number of test cases, denoted by T as input.For each test case, you should take integers N as input.
// Your task is to calculate and print the sum of the digits of the given number N.
// Problem Constraints: 1 <= T <= 1000 || 0 <= N <= 100000000 ||
// Input Format : The first line is T which means the total number of test cases.
// Each of the next T lines contain an integer N.
// Output Format: T lines each containing one integer representing the sum of the digits of the input integer.
// Example Input
// Input 1:
// 2
// 5
// 1001
// Input 2:
// 2
// 123
// 1589
// Example Output
// Output 1:
// 5
// 2
// Output 2:
// 6
// 23
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for (int i = 1; i <= T; i++) {
// int N = scn.nextInt();
// int sum = 0;
// while (N > 0) {
// sum = sum + N % 10;
// N = N / 10;
// }
// System.out.println(sum);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q5. Problem Description: Find Reverse Number
// Given a number N, print reversed of N.
// Note : Create new reverse number, instead of printing number from right to left.
// Problem Constraints: -100000 <= N <= 100000
// Input Format: N in single line
// Output Format: Print Reverse Number in single line
// Example Input
// Input 1 :12054
// Input 2 : -12500
// Input 3 : 0
// Example Output
// Output 1 : 45021
// Output 2 : -521
// Output 3 : 0
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// int i = 0;
// int reverse = 0;
// if(N<0){
// int sym = -1;
// int N1=N*-1;
// while(N1!=i){
// reverse = reverse*10 + N1%10;
// N1 = N1/10;
// }System.out.println(reverse*sym);
// }else if(N==0){
// System.out.println("0");
// }else if(N>0){
// while(N!=0){
// reverse = reverse*10 + N%10;
// N=N/10;
// }System.out.println(reverse);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q6. Problem Description: Find Last digit for T numbers
// Take T (number of test cases) as input.
// For each test case, take integer N as input and Print the last digit of that number.
// Problem Constraints: 1 <= T <= 100 || 0 <= N <= 100000000
// Input Format: The first line is the number T which denotes the total number of test cases.
// Next T lines contain an integer N for which you have to print the last digit.
// Output Format: For T different Numbers, Print the last digit in separate lines.
// Example Input
// Input 1: 2 || 94 || 512
// Input 2: 2 4987 || 264 ||
// Example Output
// Output 1: 4 2
// Output 2: 7 4
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for (int i=0; i<T;i++){
// int N = scn.nextInt();
// int last=0;
// for (int j=0;N>j;j++){
// last = N%10;
// }System.out.println(last);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q7. Problem Description: Sum of digits for T numbers
// Take T (number of test cases) as input.
// For each test case, take integer N as input and Print the sum of digits of that number.
// Problem Constraints : 1 <= T <= 100 || 0 <= N <= 100000000
// Input Format: The first line is the number T which denotes the total number of test cases.
// Next T lines contain an integer N for which you have to print the sum of digits.
// Output Format: For T different Numbers, Print the sum of digits in separate lines.
// Example Input:
// Input 1: 2 | 81 | 145 // Input 2: 2 | 201 | 1000
// Example Output: Output 1: 9 | 10 // Output 2: 3 | 1
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for(int i=0;i<T;i++){
// int N = scn.nextInt();
// int sum = 0;
// for(int j=0;N>0;j++){
// int temp=0;
// temp=N%10;
// sum=sum+temp;
// N=N/10;
// }System.out.println(sum);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q8. Problem Description: Check Palindrome for T numbers
// Take T (number of test cases) as input.
// For each test case, take integer N as input and Check whether that number is Palindromic / Not Palindromic.
// Note : A palindrome integer is an integer X for which reverse(X) = X where reverse(X) is X with its digits reversed.
// For e.g., reverse(123) = 321. Note : There will be no zeros at the start of a number.
// Problem Constraints: 1 <= T <= 100 | 0 <= N <= 100000000
// Input Format: The first line is the number T which denotes the total number of test cases.
// Next T lines contain an integer N for which you have to print Palindromic / Not Palindromic.
// Output Format: For T different Numbers, Print Palindromic / Not Palindromic in separate lines.
// Example Input
// Input 1: 2 | 101 | 51
// Input 2: 2 | 741 | 2112
// Example Output
// Output 1: Palindromic | Not Palindromic
// Output 2: Not Palindromic | Palindromic |
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for(int i=0;i<T;i++){
// int N = scn.nextInt();
// int temp1 = N;
// int reverse = 0;
// int K= N;
// for(int j=0;K>0;j++){
// reverse = reverse*10 + K%10;;
// K=K/10;
// }if(temp1==reverse){
// System.out.println("Palindromic");
// }else if(temp1!=reverse) {
// System.out.println("Not Palindromic");
// }
// }
//----------------------------------------------------------------------------------------------------------------------
// Q9. For loop-1 MCQ A
// Select the correct order for Structure of for-loop?
// for(1. ; 2. ; 3. ){
// // loop statement/work
// }
// -- > ANSWER FROM THE SOLUTIONS BELOW:
// A. 1- Condition Check, 2- Update,3- Initialisation
// B. 1- Initialisation, 2- Condition Check ,3- Update - CORRECT ANSWER ||
// C. 1- Initialisation, 2- Update,3- Condition Check
// D. None of the above
//----------------------------------------------------------------------------------------------------------------------
// Q10. For loop-1 MCQ B
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 1; i < 10; ) {
// System.out.print(i + " ");
// i++;
// }
// }
// }
// --> ANSWER FROM THE SOLUTIONS BELOW
// A. 1 2 3 4 5 6 7 8 9 10
// B. 1 2 3 4 5 6 7 8 9 --- CORRECT ANSWER
// C. 1 3 5 7 9
// D. Error
//----------------------------------------------------------------------------------------------------------------------
// Q11. For loop-1 MCQ C
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 1; i <= 10; i++) {
// System.out.print(i + " ");
// i++;
// }
// }
// }
// ---> ANSWER FROM THE SOLUTIONS BELOW:
// A. 1 2 3 4 5 6 7 8 9 10
// B. 1 2 3 4 5 6 7 8 9
// C. 1 3 5 7 9 ------ CORRECT ANSWER |
// D. Error
//----------------------------------------------------------------------------------------------------------------------
// Q12. For loop-1 MCQ D
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 1; i <= 10; i++) {
// System.out.print(i + 1 + " ");
// i++;
// }
// }
// }
// --> ANSWER FROM BELOW SOLUTIONS:
// A. 1 2 3 4 5 6 7 8 9 10
// B. 2 4 6 8 10 - CORRECT ANSWER |
// C. 1 3 5 7 9
// D. Error
//----------------------------------------------------------------------------------------------------------------------
// Q13. For loop-1 MCQ E
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 10; i > 0; ) {
// i--;
// System.out.print(i + " ");
// }
// }
// }
// --> ANSWER FROM THE BELOW SOLUTIONS ||
// A. 10 8 6 4 2
// B. 9 7 5 3 1
// C. 10 9 8 7 6 5 4 3 2 1
// D. 9 8 7 6 5 4 3 2 1 0 ----- CORRECT ANSWER |
//----------------------------------------------------------------------------------------------------------------------
// Q14. For loop-1 MCQ F
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// int i = 0;
// for(i = 0; i < 5; i++) {
// }
// System.out.print(i + " ");
// }
// }
// ---> ANSWER FROM THE BELOW SOLUTIONS:
// A. 5 ----> CORRECT ANSWER |
// B. 0
// C. 4
// D. Compilation Error
//----------------------------------------------------------------------------------------------------------------------
// Q15. For loop-1 MCQ G
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 10; i <= 5; i--) {
// System.out.print(i + " ");
// }
// }
// }
// ---> ANSWER FROM THE BELOW SOLUTIONS:
// A. 10 9 8 7 6
// B. 10 9 8 7 6 5 4 3 2 1
// C. Compilation Error
// D. No Output ----> CORRECT ANSWER |
//----------------------------------------------------------------------------------------------------------------------
// Q16. Problem Description: Palindromic Integer
// You are given an integer A as input and you need to determine whether it is a palindrome or not.
// A palindrome integer is one whose digits, when reversed, result in the same number.
// For example, 121 is a palindrome because its reverse is also 121, but 123 is not a palindrome because its reverse is 321.
// Note: The given integer will not have any leading zeros.
// Problem Constraints: 1 <= A <= 106
// Input Format: First and the only line contains a single integer A.
// Output Format: Print Yes if it is palindromic, else print No.
// Example Input: Input 1:120 | Input 2: 1001 | Input 3: 131
// Example Output | Output 1: No | Output 2: Yes | Output 3: Yes
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int reverse = 0;
// int A1 = A;
// for(int i=0;A1>0;i++){
// int revorder= A1%10;
// reverse= reverse*10 + revorder;
// A1=A1/10;
// }
// if(A==reverse){
// System.out.print("Yes");
// }else{
// System.out.print("No");
// }
//------------------------------------------ADDITIONAL PROBLEMS----------------------------------------------------------
// Q1. Problem Description:Summation Game
// Write a program to find sum all Natural numbers from 1 to N where you have to take N as input from user
// Problem Constraints: 1 <= N <= 1000
// Input Format: A single line representing N
// Output Format: A single integer showing sum of all Natural numbers from 1 to N
// Example Input: Input 1: 5 | Input 2: 10
// Example Output: Output 1: 15 | Output 2: 55
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// int sum = 0;
// for(int i=0;i<=N;i++){
// sum = sum+i;
// }System.out.print(sum);
/////// ----------------------/////////
// *** The below code is for addition of n number till 12101978
// Scanner scn = new Scanner(System.in);
// long n = scn.nextLong();
// long N = n;
// long sum = 0;
// for(long i=1;N>0;i++){
// long digsum=0;
// digsum=N%10;
// sum = sum + digsum;
// N = N/10;
// }
// System.out.print(sum);
//----------------------------------------------------------------------------------------------------------------------
// Q2. Problem Description: Easy Power
// You are given two integers A and B. You have to find the value of AB.
// NOTE: The value of AB will always be less than or equal to 109.
// Problem Constraints: 1 <= A, B <= 1000
// Input Format: First line of the input contains a single integer A.
// Second line of the input contains a single integer B.
// Output Format: Print a single integer in single line.
// Example Input: Input 1: 2 3 | Input 2: 1 10
// Example Output: Output 1: 8 | Output 2: 1
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int B = scn.nextInt();
// int Power = 1;
// while(B>0){
// A=A*1;
// Power= Power* A;
// B--;
// }System.out.print(Power);
//----------------------------------------------------------------------------------------------------------------------
// Q3. Problem Description: Multiplication Table !
// Take a number A as input, print its multiplication table having the first 10 multiples.
// Problem Constraints: 1 <= A <= 1000
// Input Format: First line contains a single integer A.
// Output Format: Print 10 lines, ith line containing ith multiple.
// Example Input Input 1: 2 | Input 2: 3 ||
// Output 1: Output 2:
// 2 * 1 = 2 3 * 1 = 3
// 2 * 2 = 4 3 * 2 = 6
// 2 * 3 = 6 3 * 3 = 9
// 2 * 4 = 8 3 * 4 = 12
// 2 * 5 = 10 3 * 5 = 15
// 2 * 6 = 12 3 * 6 = 18
// 2 * 7 = 14 3 * 7 = 21
// 2 * 8 = 16 3 * 8 = 24
// 2 * 9 = 18 3 * 9 = 27
// 2 * 10 = 20 3 * 10 = 30
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int m = 10;
// for(int i=1;i<=m;i++){
// System.out.println(A + " * " + i + " = " + (A*i));
// }
//----------------------------------------------------------------------------------------------------------------------
// Q4. Problem Description: Sum of Odds - Easy
// Take an integer A as input. You have to print the sum of all odd numbers in the range [1, A].
// Problem Constraints: 1 <= A <= 1000
// Input Format: First and only line contains a single positive integer A.
// Output Format: Print the required sum in a single line.
// Example Input --> Input 1: 1 | Input 2: 4
// Example Output --> Output 1: 1 | Output 2: 4
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int oddsum = 0;
// for(int j=1; j<=A;j++){
// if(j%2!=0){
// oddsum = oddsum + j;
// }
// }System.out.print(oddsum);
//----------------------------------------------------------------------------------------------------------------------
// Q5. Problem Description: Sum of Evens - easy
// You are given a positive integer A. You have to print the sum of all even numbers in the range [1, A].
// Problem Constraints: 1 <= A <= 1000
// Input Format: First and only line contains a single positive integer A.
// Output Format: Print the required sum in a single line.
// Scanner scn = new Scanner(System.in);
// int A = scn.nextInt();
// int evensum = 0;
// for(int j=1; j<=A;j++){
// if(j%2==0){
// evensum = evensum + j;
// }
// }System.out.print(evensum);
//----------------------------------------------------------------------------------------------------------------------
// Q6. Problem Description: Sum Of Odd & Even Digits In A Number
// You have a number N, you have to write a code to find odd digit sum and even digit sum from given number and print it.
// Problem Constraints: 0 < N < 1000000000
// Input Format: An Integer N
// Output Format
// In first line, print ("Sum of Odd Digit : x"), x is sum of odd digits
// In second line, print ("Sum of Even Digit : y"), y is sum of even digits
// Example Input Input 1 : 8563724 | Input 2 : 4524126
// Example Output
// Output 1 : Sum of Odd Digit : 15 | Sum of Even Digit : 20
// Output 2 : Sum of Odd Digit : 6 | Sum of Even Digit : 18
// Scanner scn = new Scanner(System.in);
// int N = scn.nextInt();
// int n = N;
// int oddsum = 0;
// int evensum = 0;
// for(int i=1;n>0;i++){
// int k = n%10;
// int temp = k;
// if(temp%2!=0){
// oddsum = oddsum + temp;
// }
// else if(temp%2==0){
// evensum = evensum + temp;
// }n= n/10;
// }
// System.out.println("Sum of Odd Digit : " + oddsum);
// System.out.println("Sum of Even Digit : " + evensum);
//----------------------------------------------------------------------------------------------------------------------
// Q7. Problem Description: First vs Last
// Write a program that asks the user to input a number T, indicating the number of test cases.
// Then, for each test case, ask for input a number N and print the first and last digits of N.
// Problem Constraints: 1 <= T <= 1000 | 0 <= N <= 100000000
// Input Format: First line is T which means number of test cases. Each next T lines contain an integer N.
// Output Format: T lines each containing two space separated integers representing first and last digits of the input integer.
// Example Input
// Input 1: 2 - 5 | 1001 || Input 2: 2 - 10023 | 1589
// Example Output
// Output 1: 5 5 | 1 1 || Output 2: | 1 3 | 1 9
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// int first = 0;
// int last = 0;
// for(int i=0;i<T;i++){
// int N = scn.nextInt();
// int num1=N;
// num1=num1%10;
// last=num1;
// int num2=0;
// for(int j=0;N>0;j++){
// num2=N;
// N=N/10;
// first=num2;
// }
// System.out.println(first + " " + last);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q8. Problem Description: Bank Account - 2
// You have been provided with a bank account that has an initial balance of N amount.
// You are now required to perform two operations on this account, namely, ADD and SUBTRACT.
// ADD operation: increases account balance by the amount added,
// you need to print the updated balance after each ADD operation.
// SUBTRACT operation: decreases account balance by the amount dedducted,
// you need print updated balance after each SUBTRACT operation.
// if amount subtracted (i.e., debit) from account balance is greater than current balance,
// should print "Insufficient Funds".
// Operation to be skipped.
// Note :Initial Amount N and Amount that is given are larger numbers.
// Problem Constraints: 1 <= N, X <= 1011 | 1 <= Number of operations <= 105
// Input Format: The initial balance in the bank account is provided as a single integer N.
// The number of operations to be performed on the bank account is provided as a single integer M.
// Each of the next M lines contains two space-separated integers Type and Amount(X).
// The value of Type can either be 1 or 2. If Type is 1, then the ADD operation needs to be performed,
// and if Type is 2, then the SUBTRACT operation needs to be
// performed. The value of Amount(X) represents the amount of money to be added or
// subtracted from the account.
// Output Format: Print Amount in the bank balance after each operation on a new line.
// Example Input: 1000 - 3 | 1 - 500 | 2 - 1400 | 2 - 500
// Example Output: 1500 | 100 |Insufficient Funds
// Scanner scn = new Scanner(System.in);
// int bal = scn.nextInt(); // initial balance in the account.
// int NOT = scn.nextInt(); // No. of transactions to be performed.
// for(int i=1;i<=NOT;i++){
// int type =scn.nextInt();
// int amount =scn.nextInt();
// if(type==1){
// bal=bal+amount;
// }else {
// if(amount>bal){
// System.out.println("Insufficient Funds");
// continue;
// }else{
// bal=bal-amount;
// }
// }System.out.println(bal);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q9. Problem Description: Print perfect squares
// Take an input of a number A from the user. Print all perfect squares less than or equal to A.
// Note - Perfect squares are integers whose square root is an integer. (For Example: 16 is perfect square as √16 = 4, or 42 = 16)
// Problem Constraints: 1 <= A <= 104
// Input Format: A single line consisting of a integer A.
// Output Format: Print perfect squares less than or equal to A in a single line in a space-separated manner.
// Example Input:
// Input 1: 20 ||
// Input 2: 100 ||
// Example Output:
// Output 1: 1 4 9 16 ||
// Output 2: 1 4 9 16 25 36 49 64 81 100 ||
// Scanner scn = new Scanner(System.in);
// int A=scn.nextInt();
// int sr=0;
// for(int i=1;i<=A;i++){
// sr = i*i;
// if(sr<=A){
// System.out.print(sr + " ");
// }
// }
//----------------------------------------------------------------------------------------------------------------------
// Q10. For loop-1 MCQ H
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 1; i <= 10; i++) {
// System.out.print(i++ + " ");
// }
// }
// }
// A. 1 2 3 4 5 6 7 8 9 10
// B. 2 4 6 8 10
// C. 1 3 5 7 9 - CORRECT ANSWER.
// D. Compilation Error
// Explanation Below:
// i= 1 less than 10 = Yes output(i++) = 1 (here i is still =1, and POST INCREMENT i == 2) increment(i++) = 2+1
// i= 3 less than 10 = Yes output(i++) = 3 increment(i++) = 3+1
// i= 3 less than 10 = Yes output(i++) = 5 increment(i++) = 5+1
// i= 3 less than 10 = Yes output(i++) = 7 increment(i++) = 7+1
// i= 3 less than 10 = Yes output(i++) = 9 increment(i++) = 9+1
//----------------------------------------------------------------------------------------------------------------------
// Q11. For loop-1 MCQ I
// How many times does the following loop print “Hello”?
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 1; i <= 20; i = i * 2) {
// System.out.print("Hello ");
// }
// }
// }
// A. 20 times
// B. 10 times
// C. 5 times - CORRECT ANSWER.
// D. 8 times
//----------------------------------------------------------------------------------------------------------------------
// Q12. Problem Description: For loop-1 MCQ J
// What is the correct output for following code :
// import java.util.*;
// public class Main {
// public static void main(String[] args) {
// for(int i = 11; i < 10; i++) {
// System.out.print(100 / 0);
// }
// }
// }
// A. Compilation Error
// B. Run Time Error
// C. No Output print - CORRECT ANSWER
// D. Print "100 / 0"
//----------------------------------------------------------------------------------------------------------------------
// Q13. Problem Description: : Ten Multiples
// Take T (number of test cases) as input. For each test case,
// take integer N as input and Print first 10 continuous multiples of N.
// Problem Constraints: 0 < T, N <= 1000000
// Input Format: The first line is the number T which denotes the total number of test cases.
// Next T lines contain an integer N for which you have to print first 10 multiples.
// Output Forma: Print mulitples in T different lines. For any value of N,
// print multiple in single line and space separated. Then hit an enter and print multiple of next number in new line.
// Example Input: 4 | 6 9 7 8
// Example Output
// 6 12 18 24 30 36 42 48 54 60
// 9 18 27 36 45 54 63 72 81 90
// 7 14 21 28 35 42 49 56 63 70
// 8 16 24 32 40 48 56 64 72 80
// Example Explanation
// 4 is number of test cases and next 4 numbers (i.e. 6 9 7 8) are given numbers.
// Multiple of 6 : 6 12 18 24 30 36 42 48 54 60
// Multiple of 9 : 9 18 27 36 45 54 63 72 81 90
// Multiple of 7 : 7 14 21 28 35 42 49 56 63 70
// Multiple of 8 : 8 16 24 32 40 48 56 64 72 80
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for(i=1;i<=T;i++){
// int N = scn.nextInt();
// for(j=1;J<=10;j++){
// System.out.print(N*j);
// }
// }
//----------------------------------------------------------------------------------------------------------------------
// Q14. While loop-2 MCQ E
// Given n, what is the correct option to extract the rightmost digit (least significant digit) of n?
// A. int d = n / 10;
// B. int d = n % 10; - CORRECT ANSWER
// C. int d = n % 100;
// D. None
//----------------------------------------------------------------------------------------------------------------------
// Q15. Problem Description: Count the digits
// Take T (number of test cases) as input.
// For each test case, take integer N as input and Print the count of digits of that number.
// Note: No of digits for number 0 is considered as 1.
// Problem Constraints: 1 <= T <= 100 | 0 <= N <= 100000000 ||
// Input Format
// The first line is the number T which denotes the total number of test cases.
// Next T lines contain an integer N for which you have to print the number of digits.
// Output Format
// For T different Numbers, Print the number of digits in separate lines.
// Example Input
// Input 1: 2 | 0 | 1
// Input 2: 2 | 100 | 10101
// Example Output
// Output 1: 1 | 1
// Output 2: 3 | 5
// Example Explanation
// Explanation 1: 0 and 1 both have only one digit.
// Explanation 2: 100 has three digits and 10101 has 5 digits.
// Scanner scn = new Scanner(System.in);
// int T = scn.nextInt();
// for(int i=0;i<=T;i++){
// int N = scn.nextInt();
// int count=0;
// if(N==0){
// count=1;
// }else{
// while(N!=0){
// N=N/10;
// count++;
// }
// }System.out.println(count);
// }
//----------------------------------------------------------------------------------------------------------------------
// Q16. What is the last digit of number 9784?
// 9
// 4 - CORRECT ANSWER
// 8
// 7
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: