- Design a menu driven program, that accepts an integer and displays the following menu : Displays the reverse of the number Displays whether the number is a Disarium number or not(Disarium number is a number whose digits raised to the power of their unit places sum is equal to the number. For example 135=11+32+53=1+9+125=135) exit
Example 1:
INPUT
Enter number
1
Enter the number toreverse
128
OUTPUT:
Reverse of the number is:821
Example 2:
INPUT
Enter number
2
Enter the number to check for Disarium number
135
OUTPUT:
It is a disarium number
2. Input a number to check for compositenumber or Nivennumber. Design a program to create a class perfect having two functions, one as composite(int a) another as Niven(int b)[A composite number has more than two factors]
[A Niven number is a number which is divisible by its sum of digits. For example 18 is a niven number because it is divisible by its sum of digits i.e9]
Example 1:
INPUT
Enter number
12
OUTPUT:
It is a composite number
It is a niven number.
Example 2:
INPUT
Enter number
5
OUTPUT:
It is not a composite number
It is a not niven number.
3. Design a program to accept any number and print its Tribonacci series, where the number entered should be between 10 to 50 if the entered number is not inside the range then print relevant message. (Tribonacci series has the fourth element as the sum of the previous three elements)
Example 1:
INPUT
Enter number between 10 to 50
15
OUTPUT:
0,0,1,1,2,4,7,13
Example 2:
INPUT
Enter number
52
OUTPUT:
Invalid output
4. Design a program to create an array of strings, size should be entered by the user(between 5 to 20). And sort the array in ascending order(Alphabetic order). with any sorting technique [Bubble sort or selection sort]
Example 1:
INPUT
Enter number between 5 to 20
5
Enter numbers
Apple, Zebra, Moon, Program
OUTPUT:
Array before sorting
Apple, Zebra, Moon, Program
Array after sorting
Apple, Moon, Program,Zebra
Example 2:
INPUT
Enter number between 5 to 20
32
OUTPUT:
Invalid Input.
5. Write a program to accept twowords of any length and check if they are anagrams.
Example 1:
INPUT
Enter Strings
POT,TOP
OUTPUT:
Anagrams
Example 2:
INPUT
Enter String
Papa,pepe
OUTPUT:
Not anagrams