Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do code based off three images Write a C program that asks the user to enter three numbers (integres). A menu wl be displayed

image text in transcribedimage text in transcribedimage text in transcribed

please do code based off three images

Write a C program that asks the user to enter three numbers (integres). A menu wl be displayed to let the user choose one of the three options: show the sum of the two highest numbers, product of the three numbers or the largest of the three numbers. See the sample runs. Required: Your code must use pointers ONLY! Consequently, the function malloc should be used to allocate memory spaces for the user's input and possibly for other data. Hint: Can you tell what does this code do (answer this without putting the code in the computer first)? As you can see, only pointers are used. #include #include int main () int *pointer1, *pointer2; char option; pointerlmalloc ( sizeof (int) ); pointer2- malloc (sizeof (int) option - malloc ( sizeof (char)) *option = 'Y' ; while ( *option-' y ' | | * option- 'Y ') printf (" Enter two numbers :"); scanf ("%d2d", pointe r 1, pointer2 ) ; // no & in this scanf. Why? printf printf ("%d ("%d %d= %d= %d ", %d ", *pointe r1, *pointe r1, *pointer2, *pointer2 , *pointer! *pointer! *pointer2); *pointer2 ); + + x * printf ("Do it again? y/Y or n/N: "); scanf (" %c", option); while *option != 'y' && *option != 'Y' && *option != 'n' && *option != 'N' y/Y n/N: printf ("Invalid option. scanf (" %c", option); Try again or "); return 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago