Question
Please I need a help in this program : Write an interactive program that displays a menu containing many choices as shown below: 1- split
Please I need a help in this program :
Write an interactive program that displays a menu containing many choices as shown below:
1- split a real number
2- check if a number is perfect square
3- check if a number is odd
4- Exit
You have to write 5 functions as indicated below:
Function 1 to display the choices shown above.
Function 2 to receive a real value and returns its whole and decimal parts separated.
Function 3 is to read a positive integer and returns it. This function has to make sure that the input is positive before it returns it. It will be used for choices 2 and 3.
Function 4 is a logical function that receives a positive integer number and returns 1 if it is perfect square, 0 otherwise. Perfect squares are 4,9,16,25 etc
Function 5 is also a logical function to check if an integer number is odd or not.
In the main function, your program will ask the user to select a choice then, read the data and call the right function and print the right message. Sample runs of your programs are shown below.
Note: Except for the function that reads a positive integer, all remaining functions are not allowed to have any call to scanf or printf functions.
A sample run :
1- split a real number 2- check if a number is perfect square 3- check if a number is odd 4- Exit Enter your choice1 Enter a real value> 8.76 whole part-8 decimal part-0.760000 1- split a real number 2-check if a number is perfect square 3- check if a number is odd 4- EX1t Enter your choice > 3 Enter a positive integer -45 Wrong input try again Enter a positive integer 68 68 is not odd 1- split a real number 2- check if a number is perfect square 3- check 1f a number 1s odd 4- Exit Enter your choice4 Thank you for using the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started