Guessing Game in C
Posted by Xingjuan
Last Updated: July 02, 2012
#include <stdio.h>

int main()
{

         int mybday = 20;                                             
         int guess;                                                           
         int max = 31;                                                              
         int min = 1;                                                          

         printf("Try to guess the day of my Birthday: ");               
         scanf("%d",&guess);       

         if (guess == mybday)
         {
                  printf("You Win!!");                                        
         }
         else if (guess < min)
         {
                  printf("Thats NOT A DATE!!");                
         }
         else if (guess > max)
         {
                  printf("There isn't %d days in a month!",guess); 
         }
         else if (guess > mybday)
         {
                  printf("Too High!");                             
         }
         else if (guess < mybday)
         {
                  printf("Too Low!");                    
         }
         else
         {
                  printf("Try again!!");
         }

         return 0;
}
Related Content
Number Guessing Game using C++
Number Guessing Game using C++
Samath | Jan 04, 2017
Casino Number Guessing Game in C++
Casino Number Guessing Game in C++
Samath | Jan 20, 2024
The Matching Game in Java
The Matching Game in Java
Samath | Mar 20, 2015
Hangman Game in C++
Hangman Game in C++
Samath | Jan 17, 2024
Hangman Game using C#
Hangman Game using C#
Samath | Jan 17, 2024
Animal Game in Java
Animal Game in Java
gideonna | Apr 13, 2016
Blackjack Game in C++
Blackjack Game in C++
Samath | Jan 05, 2017
Checkers Game using C++
Checkers Game using C++
Samath | Jan 17, 2024
Minesweeper Game using C++
Minesweeper Game using C++
Samath | Jan 05, 2017
Craps Dice game in C++
Craps Dice game in C++
Samath | Jan 06, 2021
Paper Strip Game using Python
Paper Strip Game using Python
Samath | Jan 17, 2024
Tic Tac Toe Game using C#
Tic Tac Toe Game using C#
Samath | Jan 17, 2024
John Conway's Game of Life using C++
John Conway's Game of Life using C++
Samath | Jan 04, 2017
C++ Rock Paper Scissors Game
C++ Rock Paper Scissors Game
Samath | Jan 05, 2017
Tic Tac Toe Game using Python
Tic Tac Toe Game using Python
Samath | Jan 17, 2024