C Project – Guess a Random Number in with Source Code

Get Certified in C Programming and Take Your Skills to the Next Level

Program 1

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
     int me,you,count=5,i=1,f=0;
      system("cls");
     srand(time(NULL));
     me=rand()%100;
    //printf("%d",me);
    
 while(i<=5)
{
    printf("\n Enter a number for guess.. you left %d chance",count);
     scanf("%d",&you);
     if(me==you)
     {
       printf("\n\nGreat... You win game is over now...");
        f=1;
       break;
     } 
     else
     if(you>me) 
        printf("\n\n Hint.. no is Grater.....");
     else
           printf("\n\nHint ..no is Less.....");
     count--;
     i++;      
}   
if(f==0)      
 printf("**********Oops you loss all chances*********");
    return 0;
}

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *