Design a menu driven program, that accepts an integer and displays the following menu :

  1. displays the reverse of the number
  2. displays whether the number is a prime number or not
  3. exit

Example 1:

INPUT

Enter number

1

Enter the number  to reverse 

125

OUTPUT:

521

Example 2:

INPUT

Enter number

2

Enter the number to check for prime number 

13

OUTPUT:

It is a prime number 

  1. Write a program to make these  patterns 
*
* *
* * *
* * * * 
 * * * * * 
12345
1234
123
12
1
  1. Design a program to create an array of integers, size should be entered by the user(between 5 to 20). And sort the array in ascending order. with any sorting technique [Bubble sort or selection sort]  

Example 1:

INPUT

Enter number between 5 to 20 

5

Enter numbers

23, 4, 58,32, 100

OUTPUT:

Array before sorting

23, 4, 58, 32, 100

Array after sorting

4,23,32,58,100

Example 2:

INPUT

Enter number between 5 to 20 

32

OUTPUT:

Invalid Input.

LEAVE A REPLY

Please enter your comment!
Please enter your name here