Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need the code typed in C In this assignment, you are going to write a program that will create an integer variable in the
I need the code typed in C
In this assignment, you are going to write a program that will create an integer variable in the main function named number (please use this name), prompt and allow the user to enter a positive integer value (e.g. greater than zero) through keyboard. Be sure to use the way that we learned in the class to use scant function, i.e., give user a prompt before calling scant function. You may assume that the user always enter a positive integer. After you get the positive integer, if that value is even (evenly divisible by 2) then divide it by 2, store the result back in the variable number, and display the result. If the value entered is odd then multiply it by 3 and add 1, store the result back in the variable number, and display the result. Your program should work for all arbitrary numbers. Your program will be tested with different integers Example Outputs in a regular compiler. The output in zyBook could be a little bit different: 32cmd exe Please enter a positive integer he next value, of the number is: 10 Press any key to continue. .. Please enter a positive number: 10 The next value of the number is: 5Step 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