Question

Declare a variable exam Grade, then ask and and get a value for exam Grade from the user. when exam Grade is an upper case or
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer-

#include<stdio.h>
#include<conio.h>
int main()
{
char examGrade; //Declaration of variable examGrade
printf("Enter examGrade of student\n"); // Asking user to enter a grade
scanf("%c",&examGrade); //taking input
switch(examGrade) //switch statement for different grade choice
{
case 'a': // for lower case a
case 'A': // for upper case A
printf("Excellent"); // printing Excellent
break;
case 'd': // for lower case d
case 'D': // for upper case D
printf("Time to Study"); // printing Time to Study
break;
default: // default for any other grade other than a and d
printf("not Recognized");
}
getch();
return(0);
}
Output-

Enter examGrade of student

a

Excellent

Enter examGrade of student

d

Time to Study

Enter examGrade of student

f

not Recognized

#include<stdio. h>. 1 #include<conio.h> 2 3 int main() 4 char examGrade; //Declaration of variable examGrade 6 printf(Enter

Output-

Enter examGrade off student Time to StudyEnter examGrade of student A ExcellentEnter examGrade of student D Time to StudyEnter examGrade of student f not Recognized

Add a comment
Know the answer?
Add Answer to:
Declare a variable exam Grade, then ask and and get a value for exam Grade from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ PROGRAMMING Implement a bool function whose header is given below. Inside the function, declare, ask,...

    C++ PROGRAMMING Implement a bool function whose header is given below. Inside the function, declare, ask, and get a character from the user. The function will return true if the character the user enters is NOT in either of the words, otherwise it will return false. Keep in mind that uppercase and lowercase letters are not the same. You will need to change both words and the character input by the user to the same case (upper or lower) -...

  • Please create the following program in C format with Visual Studio Declare any variables needed Print...

    Please create the following program in C format with Visual Studio Declare any variables needed Print “Hello my name is (add your name here)” onto the screen. Ask the user for a number. Scan the number from the user. Multiply the number by 123. Print the original number and the product back onto the screen. Ask the user for a letter. Scan the letter from the user. Make an uppercase and a lowercase version of the letter (use toupper and...

  • Evaluate Exponent: Declare a double variable called result and initialize it to 1.0; Ask the user...

    Evaluate Exponent: Declare a double variable called result and initialize it to 1.0; Ask the user for two values - one for the base, and the other for the exponent. If the exponent parameter is 0, give the user an error. You do not need to handle a negative exponent value. Otherwise, declare an integer variable called loop and initialize it to 0 Write a do while loop as follows: Inside the loop: Multiply the results times the number Increment...

  • // Group Names: // Date: // Program Description: //   Import required packages //--> //   Declare class...

    // Group Names: // Date: // Program Description: //   Import required packages //--> //   Declare class (SwitchDoLab) //--> {    //   Declare the main method    //-->    {        //   Declare Constant integers SUM = 1, FACTORIAL = 2, QUIT = 3.        //-->        //-->        //-->        //   Create an integer variable named choice to store user's option.        //-->        //   Create a Scanner object        //   Create...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

  • Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To...

    Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To compile, build, and execute an interactive program with a simple loop, conditions, user defined functions and library functions from stdio.h and ctype.h. You will write a program that will convert characters to integers and integers to characters General Requirements • In your program you will change each letter entered by the user to both uppercase AND lowercase– o Use the function toupper in #include...

  • Python Programming 4th Edition: Need help writing this program below. I get an error message that...

    Python Programming 4th Edition: Need help writing this program below. I get an error message that says that name is not defined when running the program below. My solution: def main(): filename = "text.txt" contents=f.read() upper_count=0 lower_count=0 digit_count=0 space_count=0 for i in contents: if i.isupper(): upper_count+=1 elif i.islower(): lower_count+=1 elif i.isdigit(): digit_count+=1 elif i.isspace(): space_count+=1 print("Upper case count in the file is",upper_count) print("Lower case count in the file is",lower_count) print("Digit count in the file is",digit_count) print("Space_count in the file is",space_count)...

  • IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality...

    IP requirements: Load an exam Take an exam Show exam results Quit Choice 1: No functionality change. Load the exam based upon the user's prompt for an exam file. Choice 2: The program should display a single question at a time and prompt the user for an answer. Based upon the answer, it should track the score based upon a successful answer. Once a user answers the question, it should also display the correct answer with an appropriate message (e.g.,...

  • I've managed to get through the basic level of encryption, but the advanced and military grade...

    I've managed to get through the basic level of encryption, but the advanced and military grade sections are beyond me. If someone can show me what the hell this code is supposed to look like I'd greatly appreciate it. In other words I need to write a code that can decrypt a string message by the following parameters. Basic: Using Caesar Cipher with a static shift of 1-25. This is easy to decrypt as there are only 25 possibilities. Advanced:...

  • Required functions def inputWithinRange (lowValue, highValue): This function will ask for a number from the keyboard....

    Required functions def inputWithinRange (lowValue, highValue): This function will ask for a number from the keyboard. The function will only return a value that is within the inclusive range of lowValue to highValue. If the entered value is not within the provided range, the function will ask again until the user has entered an acceptable value. The function will return the accepted value. def doContinue (prompt): This function will ask for a string using the prompt parameter. The function will...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT