You are on page 1of 1

There are a lot of programs that need to be measured.

Thjis programs i snju just oe of them


Please be very specific about your problem.
Because, you know, I am ot perfect.
#include <stdio.h>
main ()
{
int user, pc, sticks=21;
while( sticks )
{
printf( "User's Turn -> Choose your number of matchsticks: " );
scanf( "%d", &user );
if( user > 4 )
{
printf( "What are you doing.... You can choose upto 4 ma
tchsticks only" );
return;
}
/* The computer must always remain at a multiple of 5, i.e 5, 10
, 15 or 20 */
pc = 5 - user;
printf( "Computer's Turn -> %d Matchsticks", pc );
sticks -= ( user+pc );
if( sticks == 1 )
{
printf( "\nYou lose." );
break;
}
}
}

You might also like