/* Kalyaan Narnamalpuram
   09/13/2022
   Section 001
   Lab - 3
   This program promts the user with an question and asks them to type out an alphabet.('a' or 'A') 
   for apples and ('o' or 'O') for Oranges. This program shows error when the user enters any other 
   alphabets. This program repeatedly promts the question until the user types 'q' to quit. 
*/  

#include <stdio.h>
int main(void)
{
		char  userInput;
		printf("Enter an a for apple or o for orange:");
  	        scanf(" %c" , &userInput);
    	
	while ( userInput != 'q')
		{
			if (userInput == 'a' || userInput == 'A' )
      				 {
         				 printf("You chose apples!\n");
					 printf("Enter an a for apple or o for orange:");
				 	 scanf(" %c" , &userInput);
      				 }
   			 else if (userInput == 'o' || userInput == 'O' )
      				 {
         				 printf("You chose oranges!\n");
					 printf("Enter an a for apple or o for orange:");
					 scanf(" %c" , &userInput);
      				 }
   			 else 
     				 {
        				 printf("You entered an invalid letter.\n");
					 printf("Enter an a for apple or o for orange:");
					 scanf(" %c" , &userInput); 
     				 }
		}
		
			if  ( userInput == 'q')
				{
					printf("Good bye!\n");
 				}
	return 0;	
 } 
