Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“Jnana Sangama”, Belagavi-590018, Karnataka

Principle of programming using C ( BPOPS103)

Mini project

On

“ARMSTRONG NUMBER “
Submitted in partial fulfilment of the requirements for the award

of the Degree of bachelor of engineering in

Computer Science & engineering

Submitted by

Name : RAGHAV LANGER

Under the guidance of

Mrs. Geetha R

Assistant Professor

Department of CS&E , BIT

Bengaluru-560004

BANGALORE INSTITUTE OF TECHNOLOGY

K .R. Road , V.V.Pura,Bengaluru-560004

2023-2024
INTRODUCTION
Rock ,paper ,scissors (commonly scissors, paper, rock or stone in Australia and New
Zealand) is a intransitive hand game usually played between two people, in which each
player simultaneously forms one of three shapes with an outstretched hand. These shapes are
"rock" (a closed fist), "paper" (a flat hand), and "scissors" (a fist with the index finger and
middle finger extended, forming a V). The earliest form of "rock paper scissors"-style game
originated in China and was subsequently imported into Japan, where it reached its modern
standardized form, before being spread throughout the world in the early 20th century. The
program typically starts by displaying a prompt for the user to input their choice (rock, paper,
or scissors). It then generates the computer's choice and compares the two to determine the
winner based on the established rules.

This introductory structure provides an engaging platform for beginners to practice


fundamental programming concepts, fostering understanding of input/output operations,
conditional statements, and basic game logic.
SOURCE CODE

#include<stdio.h>

#include<stdlib.h>

int main()

//0,1,2,,0==Rock,1==Paper,2==Scissor

int usermove , computermove;

while(1){

printf ("\n Enter your move: \t 0 For Rock\t 1For Paper \t 2FOr scissors\t 9 to exit");

scanf("%d",& usermove); computermove=rand() % 3;//0,1,2

if(user move==9){

exit(1);

else if(usermove==0 && computermove==1){

printf("\n The Might computer has bested you! \t Paper Beats Rock");

else if(usermove==0 && computermove==2){

printf("\n The Might computer has bested you! \t Rock beats scissors");

else if(usermove==1 && computermove==0){

printf("\n The Might computer has bested you! \t Paper Beats Rock");

else if(user move==1 && computer move==2){

printf("\n The Might computer has bested you! \t Scissors beats paper");

}
else if(usermove==2 && computermove==0)

printf("\n The Might computer has bested you! \t Rock beats paper");

else if(usermove==2 && computermove==1){

printf("\n The Might computer has bested you! \t Scissor beats paper");

else{

printf0("SHOOT, Its a draw!");

}
Output
What is the benefit of rock , paper , scissors ?

Implementing Rock, Paper, Scissors in C is an engaging coding exercise that not only
fortifies fundamental programming skills like working with conditionals and
randomization but also fosters a deeper understanding of algorithmic thinking. This
practical project enhances the coder's ability to handle user interactions, making it a
valuable and enjoyable learning experience. It provides a practical and fun way to
practice these skills while creating an interactive game. Additionally, it allows you to
explore concepts like loops for replay ability and functions for modular code.
Conclusion

In conclusion, implementing the Rock, Paper, Scissors game in C is a beneficial


coding exercise. It reinforces essential programming concepts, including conditionals
and randomization, while simultaneously promoting a deeper grasp of algorithmic
thinking. The project is not merely a technical exercise; it also enhances user
interaction skills, making it an enjoyable and valuable learning opportunity for
programmers.

You might also like