Number Catching Game| C Languange|Busy

in #busy6 years ago

Basic game for c learners

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main (void)
{

int playerNum, n,randNum,looop=1,loop=1,sum=0;
srand(time(NULL));



    
randNum=rand()%1000;
printf("Please enter a number for start:");


do{
scanf("%d",&playerNum);
sum++;
    
if(playerNum==randNum)
{
printf("Congrt, you find it %d",sum);

loop=0;
}
else if(playerNum>randNum)
{
    printf("Make smaller");
}
else
{
    printf("Make higher");
}

}while(loop==1);

return 0;

}

Sort:  

i love the lay out of c program though it looks better when you use a dowhile(loop==1)

This post has received a 0.42 % upvote from @morwhale thanks to: @onlyblack.

Release the Kraken! You got a 1.02% upvote from @seakraken courtesy of @onlyblack!

You got a 0.80% upvote from @mercurybot courtesy of @onlyblack!

You just planted 0.03 tree(s)!


Thanks to @onlyblack

We have planted already 7401.68 trees
out of 1,000,000


Let's save and restore Abongphen Highland Forest
in Cameroonian village Kedjom-Keku!
Plant trees with @treeplanter and get paid for it!
My Steem Power = 18431.77
Thanks a lot!
@martin.mikes coordinator of @kedjom-keku
treeplantermessage_ok.png

Coin Marketplace

STEEM 0.29
TRX 0.13
JST 0.033
BTC 62931.02
ETH 3031.06
USDT 1.00
SBD 3.64