Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with code Write a program called lab6. C which will prompt the user to enter a single letter or a single digit number on

image text in transcribed
Help with code
Write a program called lab6. C which will prompt the user to enter a single letter or a single digit number on the keyboard. If the user enters a lower ease letter, the program will print out the same letter as a capital letter If the userenters a capital letter, the program will print out the same letter in lower ease. If the user enters an even number, theprogram will print out a message saying that it is an even number If the user enters an odd number, the program will printout a message saying that it is an odd number. If the user enters anything that ts not a letter or a number, the program willprint out a message indicating that they entered an invalid character The message your program prints out must be exactlyas show n in the examples below the next paragraph. Once you get that working, make the program loop continually, asking the user if they want to go again, using a 1 for yes and a 0 for no. If they enter a 1, then they will be prompted to enter a single letter or number on the keyboard again, displaying the results explained above. If they enter a 0, then the program will quit. With this loop added, your outputshould look like the following examples Enter a letter or number from the keyboard, d The upper case of that letter is: D. Would you like to go again? Enter 1 for yes, 0 for no. 1 Enter a letter or number from the keyboard. R The lower case of that letter is: r. Would you like to go again? Enter 1 for yes, 0 for no. 1 Enter a letter or number from the keyboard. 6 You entered an even number. Would you like to go again? Enter 1 for yes, 0 for no. 1 Enter a letter or number from the keyboard. 3 You entered an odd number. Would you like to go again? Enter 1 for yes, 0 for no. 1 Enter a letter or number from the keyboard. ? You entered an invalid character. Would you like to go again? Enter 1 for yes, 0 for no. 0 Once you are certain that your program works with the addition of the loop, add some code that will check for invalid input for going again (this code should prompt the user repeatedly if the input is not 0 or 1). For example: Enter a letter or number from the keyboard. 5 You entered an odd number. Would you like to go again? Enter 1 for yes, 0 for no. 9 Invalid input. Enter a 1 to go again, or a 0 to quit: 3 Invalid input. Enter a 1 to go again, or a 0 to quit: 5 Invalid input. Enter a 1 to go again, or a 0 to quit: 7 Invalid input. Enter a 1 to go again, or a 0 to quit: 6 Invalid input. Enter a 1 to go again, or a 0 to quit: 2 Invalid input. Enter a 1 to go again, or a 0 to quit: 4 Invalid input. Enter a 1 to go again, or a 0 to quit: 8 Invalid input. Enter a 1 to go again, or a 0 to quit: 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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions