# data[].attributes.body
   int b, c;
        for (int i = 0; i < arr.length; i++) {
            b = arr[i];
            c = 0;
            
            while (b != 0) {
                c *= 10;        // shift to left
                c += b % 10;    // add the lst digit of b
                b /= 10;        // shift to right
            }
            
            arr[i] = c;
        }

# data[].attributes.body
public class q1 {

    public static void main(String[] args) {

        for (int i = 1; i <= 20; i++) {

            int s = generateTriangularNumber(i);
            System.out.println(s);
        }
    }

    static int generateTriangularNumber(int n) {
        int sum = 0;

        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        return sum;
    }

}

# data[].attributes.body
  Random r = new Random();
        Scanner sc = new Scanner(System.in);

        int a = r.nextInt(13);
        int b = r.nextInt(13);
        System.out.printf("%d x %d = ", a, b);
        int ans = sc.nextInt();
        
        if(checkEqual(a, b, ans)) {
            System.out.println("CORRECT");
        }
        else
        {
            System.out.println("WRONG");
        }
        
        

    }

    static boolean checkEqual(int a, int b, int ans) {
        // 1
        /* if(a * b == ans)
            return true;
        else
            return false; */

        // 2
        return a * b == ans;
    }

# data[].attributes.body
public class q6 {

public static void main(String[] args) {
int N = 20;

System.out.println("Palidromic Primes(20)");
for (int i = 0, j = 1; i < N; j++) {
if (isPalindromicPrime(j)) {
System.out.println(j);
i++;
}
}
System.out.println("EPrimes(20)");

for (int i = 0, j = 1; i < N; j++) {
if (isEprime(j)) {
System.out.println(j);
i++;
}
}
}

static boolean isPrime(int n) {
if (n == 2) {
return true;
} else if (n > 2 && n % 2 == 0) {
return false;
} else {
for (int i = 3; i < n / 2; i++) {
if (n % i == 0) {
return false;
}
}
}

return true;
}

static int reverseInt(int b) {
int c = 0;

while (b != 0) {
c *= 10;        // shift to left
c += b % 10;    // add the lst digit of b
b /= 10;        // shift to right
}

return c;
}

static boolean isPalindrome(int a) {
return a == reverseInt(a);
}

static boolean isPalindromicPrime(int a) {
return isPrime(a) && isPalindrome(a);
}

static boolean isEprime(int a) {
return isPrime(a) && isPrime(reverseInt(a)) && !isPalindrome(a);
}
}

# data[].attributes.body
import java.util.Random;
import java.util.Scanner;

public class q5 {

public static void main(String[] args) {
Random r = new Random();
Scanner sc = new Scanner(System.in);

int a = r.nextInt(13);
int b = r.nextInt(13);
System.out.printf("%d x %d = ", a, b);
int ans = sc.nextInt();

if(checkEqual(a, b, ans)) {
System.out.println("CORRECT");
}
else
{
System.out.println("WRONG");
}

}

static boolean checkEqual(int a, int b, int ans) {
// 1
/* if(a * b == ans)
return true;
else
return false; */

// 2
return a * b == ans;
}
}

# data[].attributes.body
public class q4 {
public static void main(String[] args) {
// test
System.out.println("GCD of 24 and 8 is " + gcd(24, 8));
}

static int gcd(int a, int b) {
while(b != 0) {
int t = b;
b = a % b;
a = t;
}
return a;
}
}

# data[].attributes.body
import java.util.Arrays;

public class q3 {

public static void main(String[] args) {
int arr[] = {1234, 5647, 4342, 3412};
System.out.println(Arrays.toString(arr));
reverseDigits(arr);
System.out.println(Arrays.toString(arr));

}

/**
* pass by reference method
*/
static void reverseDigits(int[] arr) {
int b, c;
for (int i = 0; i < arr.length; i++) {
b = arr[i];
c = 0;

while (b != 0) {
c *= 10;        // shift to left
c += b % 10;    // add the lst digit of b
b /= 10;        // shift to right
}

arr[i] = c;
}
}

}

# data[].attributes.body
public class q2 {

public static void main(String[] args) {
int row = 8;

System.out.println("Triangle");
for (int i = 1; i <= row; i++) {
multiPrint(row - i, ' ');
multiPrint(2 * i - 1, '*');
System.out.println();
}

System.out.println("\n\nDiamond");
for (int i = 1; i <= row; i++) {
multiPrint(row - i, ' ');
multiPrint(2 * i - 1, '*');
System.out.println();
}

for (int i = row -1; i >= 0; i--) {
multiPrint(row - i, ' ');
multiPrint(2 * i - 1, '*');
System.out.println();
}

}

static void multiPrint(int n, char c) {
// 1
for (int i = 0; i < n; i++) {
System.out.print(c);
}

// 2
/* String s = "";
for (int i = 0; i < n; i++) {
s += c;
}
System.out.print(s); */
}

}

# data[].attributes.body
public static void function(int n, int k){
int up=1;
int down=1;
for(int i=((n-k)+1); i<=n; i++){
up *= i;
}
for(int i=1; i<=k; i++){
down *= i;
}
System.out.println(up/down);
}

# data[].attributes.body
public class q1 {

public static void main(String[] args) {

for (int i = 1; i <= 20; i++) {

int s = generateTriangularNumber(i);
System.out.println(s);
}
}

static int generateTriangularNumber(int n) {
int sum = 0;

for (int i = 1; i <= n; i++) {
sum += i;
}
return sum;
}

}