Random Number Memory Game in C Last Updated : 28 Apr, 2021 Comments Improve Suggest changes Like Article Like Report In this article, will design a simple number memory game in the C programming language. It is a simple memory number game where a random number is displayed and is hidden after some time. The task is to guess that displayed number to continue the game. How to Play This Game: Press 1 on your keyboard to start the game.A random positive number is displayed in the console which the player has to remember.After few seconds the number displayed will disappear.At the next line in the console, the player has to input the number shown previously.If the input number is the same as the previous number then the player's score increases by 1 and the game continue.If the input number is incorrect, the game ends and the player's score is displayed. Below is the implementation of the above approach: C // C program to implements the above // memory game #include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> // Function to generate the random // number at each new level int randomnum(long level) { clrscr(); printf("Level %ld \n", level); long num; num = (rand() % 100 * level) + 1 + level * 5.2f; printf("Number : %ld \n", num); delay(2000 - (10 * level)); clrscr(); // Return the number return num; } // Driver Code void main() { clrscr(); long num; long guessnum; long level = 1; long inputnum; // Start the game printf("Press 1 to start Game! "); scanf("%ld", &inputnum); // Game Starts if (inputnum == 1) { // Iterate until game ends do { // Generate a random number num = randomnum(level); // Get the guessed number scanf("%ld", &guessnum); level++; // Condition for the Game // Over State if (guessnum != num) { printf("You Failed! "); } } while (num == guessnum); } getch(); } Output: Comment More infoAdvertise with us Next Article Random Number Memory Game in C O onlyklohan Follow Improve Article Tags : Project Game Theory C Language DSA Practice Tags : Game Theory Similar Reads Random password generator in C In this article, we will discuss how to generate a random password of a given length consists of any characters. Approach: The below-given program involves basic concepts like variables, data types, array, loop, etc.Follow the below steps to solve this problem:Take the length of the password and dec 2 min read Memory Game in Java The Memory Game is a fun and simple two-player game that tests your memory. In this game, a set of cards is laid face down. Players take turns flipping two cards to find matching pairs. If the two cards match, they remain face up. If not, they are flipped back down. The game continues until all pair 5 min read Pacman Game in C Making projects is one of the most interesting and fun ways to learn a programming language such as C. In this article, we will learn how to write code for the Pacman game in C. What is Pacman Game?Pacman Game is a classic arcade video game that was first released in 1980 by Namco (formerly known as 5 min read Common Memory/Pointer Related bug in C Programs Dereferencing an unknown memory location : C programmers mostly use scanf() function to take input, but sometimes a small mistake can bring a bug or even crash whole program. The syntax for scanf() is scanf("%d", &a);. It might be possible to miss a & and write &a as a so now scanf("%d", 6 min read Snake and Ladder Game in C Snake and Ladder game is a traditional game that involves two or more players and the winner is the guy who reaches the final square on the game board at the earliest. Components of the GameA square board with a series of numbered squares arranged in m x m grid.A dice to be rolled usually uses a six 5 min read Like