Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

thers`s a problem if i wrote a large code in my way or what?

0 votes
asked Oct 13, 2018 by Amr Mehana (150 points)
edited Oct 13, 2018 by Amr Mehana

#include <stdio.h>
#include <stdlib.h>
int main()
{
    printf(" \t \t This  program to play a guess game with the user  \n " ); printf("\n");
    int x = rand()%11 , num ,counter=1 ;

    printf( "Guss a number from 1 to 10 \n");
    scanf("%d",&num);
    if ( num>10 || num <1  )
        printf("Please Run The Program again and put a number from 1 to 10 \n ");
    else
do {

    if ( num==x  ) {
    printf(" Congratulations You win (:  \n " );break; }

   else if (num != x) {
     printf("Wrong guss 2 tries remaining  ):  \n " );
      counter++; }

  printf("\n");

    printf( " try again and Guss a number from 1 to 10 \n");
    scanf("%d",&num);

 if ( num==x  ) {
    printf(" Congratulations You win (:  \n " ) ;break; }

   else if (num != x) {
     printf("Wrong guss 1 tries remaining ):  \n " );
      counter++; }

  printf("\n");

 printf( " try again Guss a number from 1 to 10 \n");
    scanf("%d",&num);

 if ( num==x  ) {
    printf(" Congratulations You win (:  \n " );break;}

   else if (num != x) {
     printf(" Sorry no tries remain You lose ):  \n " );
      counter++; }
}
while ( counter<=3 );

    return 0;
}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...