Skip to main content

Make A Number Guessing Game using C language | Coding With Roannie

 Make A Number Guessing Game using C language | Coding With Roannie


Source Code :

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main() {
    int numberguess , nguesses=1;
    srand(time(0)); //this is generate a random number
    number = rand()%100 + 1// random number between 1 to 100

    do
    {
        printf("Guess The Number Between 1 to 100:\n");
        scanf("%d",&guess);
        if(guess>number){
            printf("Higher Number Please!\n");
        }
        else if(guess<number){
            printf("lower Number Please!\n");
        }
        else{
            printf("You Guessed it In %d Attempts",nguesses);
        }
        nguesses++;
    } while (guess!=number);
    


return 0;
}




If This Is Helpful to YOU Please Subscribe Us On YouTube

My Channel Link : My YouTube Channel


SUBSCRIBE US FOR LATEST UPDATE