Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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...)

image text in transcribed

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

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

List the activities involved in employer-designed HRD programs

Answered: 1 week ago

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago

Question

6. What data will she need?

Answered: 1 week ago