Description
- Write a Java program that accepts the number and its exponent and returns the power of the number.
Sample Input
Enter the base of the number: 3
Enter the exponent: 4
Sample Output
81
- Write a Java program that accepts two numbers, “a” and “b” from the user input and swap the numbers without using a third variable Sample Input a=25 b=40 Sample Output a = 40 b=25
- Write a Java program that accepts a number and find the number of digits in the given number.
Sample Input
34320
Sample Output
5
- Write a Java program that accepts a number and returns the reverse of that number.
Sample Input
5432
Sample Output
2345
- Write a Java program that accepts an integer array of size “N” from the user as input and prints the array in sorted order (Descending order). Write your sorting function.
Sample Input
Size of the array, N=5
18 7
25
33
1
Sample Output
33 25 18 7 1
- Write a Java program that accepts a number and returns true when the number is Palindrome and false otherwise.
Sample Input 1 | Sample Input 2 |
343 | 1256 |
Sample Output 1
True |
Sample Output 2
False |
- Write a Java program that accepts N as user input and finds the Fibonacci series of N numbers.
Sample Input
9
Sample Output
0 1 1 2 3 5 8 13 21