Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can I get assistance with the following. Here are the requirements Modify the program Figure 2.10 (limit/num). Review the book section on the switch statement
Can I get assistance with the following. Here are the requirements
Modify the program Figure 2.10 (limit/num). Review the book section on the switch statement and the 'else if' clause Add new 'const' variables: base2, base3, base8, base10 and base16. Assign them the value the name implies Ask the user to enter a number base (2, 3, 8, 10 or 16) Follow the table below to output the correct value: base output ----- ------ 2 Binary 0..1 3 Trinary 0..2 8 Octal 0..7 10 Decimal 0..9 16 Hexidecimal 0..F In other words, the program used to do this: 99 low Now it should do this 8 Octal 0..7 If you run it again: 2 Binary 0..1 If you run it again: 16 Hexidecimal 0..F Use 'else if' statements AND the 'const' variables to test the input. Use an 'else' at the very end and print an error messge when the input is NOT 2,3,8,10 or 16
Here is my code.
#include
int main(int argc, char** argv) { const int limit = 100; int num; scanf("%d", &num); if(num >= limit){ printf("high "); } else{ printf("low "); }
return (0); }
Thank you
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