Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Problem Statement: Write an interactive program that displays a menu containing many choices as shown below: 1- split a real number 2- check if a

Problem Statement:

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

this is how the program should like

image text in transcribed

thanks

Select DAics 1031 172 workareal hw3.exe 1- split a real number 2- check if a number is perfect square 3- check if a number is odd 4- Exit Enter your choice2 Enter a positive integer -89 Wrong input try agairn Enter a positive integer -44 Wrong input try agairn Enter a positive integer 56 56 is not a perfect square 1- split a real number 2- check if a number is perfect square 3- check if a number is odd 4- Exit Enter your choice > 4 Thank you for using the program Process exited after 36.53 seconds with return value o Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started