Question: WRITE CODE IN C. Only use switch operators and don't hardcode each number. Print numbers 1-99 (one, two, three, four, five, six, seven, eight, nine,

WRITE CODE IN C. Only use switch operators and don't hardcode each number. Print numbers 1-99 (one, two, three, four, five, six, seven, eight, nine, ten, eleven...)

WRITE CODE IN C. Only use switch operators and don't hardcode each

Concepts to Practice - For loops and/or do/while loops - The conditional (ternary) operator and/or the switch statement - Extend Prelab 4 Submission Information Submit this assignment by following the instructions given by your TA. SUBMIT ONLY the .c file (no a.out or executable file is required). All of the lab assignments must be submitted before the end of the lab using the lab code given by the TA. Use the following submit command: mucs submit For example: mucs submit 1050 lab4 lab4.c Description For the lab assignment, you may use any C statements you wish. However, you will get bonus points if you correctly solve the problem without using the if statement, the if/else statement, nor the while statement. Similar to the prelab, you are to convert integers to words. For example, if the integer is 1 , you should print "one". If the integer is 2, you should print "two". Do not "hard code" things (i.e., don't just print "one two three four five six seven eight nine ten" but instead loop through all the integers). You may use a for loop or a do/while loop to accomplish this. Inside your loop, you will need some way to decide what to print based on the value of the current integer. To accomplish this part, consider using a switch or the ternary operator. The difference this time is that you need to print all integers from 1 through 99 ! Don't worry about hyphenating and don't worry if there is an extra space or two floating around. Do, however, put a comma between each number (so we can easily tell which is which). If you have an extra comma or two floating around, don't sweat that either. Hints - Structure your code so you print a word that corresponds to each digit. How can you figure out what each digit of an integer is? Well, how about good old integer division? - Don't worry about the "teens" at first. Start with just pretending that ten is "teen", eleven is "teen one", and twelve is "teen two" (if English made any sense, that's what it would be anyway). If you get everything else done, you can always go back and try to deal with the teens

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!