In: Computer Science
WRITTEN IN C PLEASE.
Write a switch statement that tests the value of the char variable response and performs the following actions: if response is y, the message Your request is being processed is printed if response is n, the message Thank you anyway for your consideration is printed if response is h, the message Sorry, no help is currently available is printed for any other value of response, the message Invalid entry; please try again is printed
#include<stdio.h>
int main(){
char response;
printf("Enter char: ");
scanf("%c",&response);
//starting switch case with given char
switch(response){
// two cases for upper and lower cases
case 'Y':
case 'y':
printf("Your request is being processed");
break;
// two cases for upper and lower cases
case 'n':
case 'N':
printf("Thank you anyway for your consideration");
break;
// two cases for upper and lower cases
case 'h':
case 'H':
printf("Sorry, no help is currently available");
break;
default: printf("Invalid entry");
}
}
Note : If you like my answer please rate and help me it is very Imp for me