C

Guess the Number C Game Program1 min read

In this tutorial we are writing Guess the Number C Program.

First the program will print that it has a number in its mind, and the user have to guess it.User have infinite chances for guessing the right number.




In c language rand function is used for getting random numbers. To make sure that we get different sequence of random numbers for separate runs, we use srand function and pass the system time in seconds using time function.

To use rand and srand functions, we need to include stdlib header file and for getting time using time function we need to include time.h header file.

Program Source Code : guess_the_number.c

Output:

Guess the Number C Game Program
Guess the Number C Game Program

Leave a Comment