vichitr / HacktoberfestForBeginners

New to open-source? Contribute here!!!
MIT License
103 stars 360 forks source link

Simplistic Number Game #577

Open gpsunnyi opened 1 year ago

gpsunnyi commented 1 year ago

I would like to add a guessing number game here if possible. All the best.

AKxy4321 commented 1 year ago

I would like to add a guessing number game here if possible. All the best.

include

include

int main() { printf("Welcome to the Number Guessing Game\n"); while(1) { int num,choice; int key = 1; //number to guess input printf("Enter a number\n"); scanf("%d",&num); if(num == key) { printf("Number is Found - %d\n",key); printf("Thank you for playing this game"); exit(0); } else if(num > key) { printf("The number you guessed is greater than the required number\n"); } else { printf("The number you guessed is lesser than the required number\n"); } printf("Do you want to try the game again\nPress 0 for no\n"); scanf("%d",&choice); if(choice == 0) { printf("Thank you for playing this game again"); exit(0); } printf("You have chosen to play the game\n"); } }

AKxy4321 commented 1 year ago

I would like to participate in the making of the game, I can code it in C, Python and Js