Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help coding still exactly Write a program called 1 ab6. c which will prompt

ID: 3799261 • Letter: N

Question

Need help coding still exactly Write a program called 1 ab6. c which will prompt the user to enter a single letter of a single digit number on the keyboard. If the user enters a lower case letter, the program will print out the same letter as a capital letter. If the user enters a capital letter, the program will print out the same letter in lower ease. If the user enters an even number, the program will print out a message saying that it is an even number. If the user enters an odd number, the program will print out a message saying that it is an odd number. If the user enters anything that is not a letter or a number, the program will print out a message indicating that they entered an invalid character. The message your program prints out must be exactly as show n in the examples below the next paragraph. Once you get that working, nuke the program loop continually, asking the use 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 w ill quit. With this loop added, you output should 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 ye3, 0 for no. 0 Once you arc 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

Explanation / Answer

#include <stdio.h>
#include <ctype.h>
int main()
{
int a;
do {
char c;
printf("Enter a letter or number from keyboard: ");
scanf("%c",&c);
if(isalpha(c)){
if(c>='a' && c<='z')
printf("The upper case of letter is: %c", toupper(c));
else if (c>='A' && c<='Z')
printf("The lower case of letter is: %c",tolower(c));
}
else if(isdigit(c)) {
if(c%2 == 0)
printf("You entered an odd number");
else
printf("You entered an even number");
}
  
printf("Woyld you like do it again? Enter 1 for yes and 0 for no. ");
scanf("%d", a);
}while(a == 1);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote