C Project – Rock Paper Scissor

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

Program 1

// Rock , Paper , Scissors Game
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define clrscr() system("cls")
int main()
{
    clrscr();
    int userchoice,compchoice;
    srand(time(0));
    compchoice=rand()%3+1;
    printf("\n ------------Rock , Paper , Scissors Game-----------");
    printf("\n 1 . Rock");
    printf("\n 2 . Paper");
    printf("\n 3 . Scissors");
    printf("\n--------------------------------------------------------");
    printf("\nEnter your Choice !");
    scanf("%d",&userchoice);
    printf("\n User Choice: %d",userchoice);
    printf("\n Computer Chose: %d",compchoice);
    if(userchoice==compchoice)
    printf("\n Game is tie !");
    else
    if((userchoice==1 && compchoice==3) || (userchoice==2 && compchoice==1) || (userchoice==3 && compchoice==2))
      printf("\n You won the Game !");
      else
      printf("\n You lose the Game !");
return 0;
}

 

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

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

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