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.

Beginner Friendly Project Ideas (Python)

+3 votes
asked Oct 23, 2022 by Eidnoxon (5,270 points)
  1. Guess The Number

Guess The Number is a little difficult to create if you didn't sawed any example of it. You need to know: While Loops, else if statements, variables, random number generating, User Input. Your code should look like this: 

https://onlinegdb.com/rieZRwI3N

        2. Dice Rolling

Dice Rolling. You just have to generate a random number 1 to 6, and then print the number. You need to know: Random Number Generating, Variables. Your code should look like this: https://onlinegdb.com/ABPyrxm2OP

1 Answer

0 votes
answered Oct 25, 2022 by Harshith .R (360 points)
//i did guessing a number using c language hope it helps

#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void main()
{
    int a,b;
    srand(time(0));
    printf("LETS CHECK YOUR GUESSING ABILITY\n");
    printf("PLEASE ENTER ANY NUMBER BELOW 100!\n");
    scanf("%d",&a);
    do{
    b=rand();
    b++;
    
    }while(b>100);
    if(a==b)
    printf("YAY!!MAN YOU MASTERED IT\n");
    else if(a>b)
    printf(" OPPS!!...NUMBER IS LESSER THAN YOU EXPECT\n");
    else
    printf("OPPS!!...NUMBER IS GREATER THAN YOU EXPECT\n");
    printf("UFF!! AND THE NUMBER IS %d",b);
}
commented Oct 27, 2022 by Peter Minarik (88,520 points)
I think it would be better if the user could keep guessing until they find the number and not have only one chance (with a 1/101 probability) to guess right.
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.
...