Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lab 7 blackjack v0.6
//gcc 5.4.0 #include <stdio.h> //PRINT " Please input 2 integers" //int x; //int y; //int sum; //READ x and y //sum=x+y; //if(sum>21) // PRINT "You Lose\n"; //else //{ // while(sum<=21&&sum>=17) // { // READ x // sum=x+sum; // continue; // } //} //printf("%d\n",sum); //if(sum>21) // PRINT "You Lose :( \n"; //else // PRINT "YOU WIN!!!!! :)\n" int main(void) { printf("Please input 2 positive integers.\n"); int x; int y; int sum; scanf("%d%d",&x,&y); char a; a=isdigit(x); char b; b=isdigit(y); if(x<0||y<0){ printf("There are no negative cards :["); return 0; } else if( a==0||b==0){ printf("I can only use integers :["); return 0; } // else{ // continue // } sum=x+y; if(sum>21) printf("%d\nYou Lose\n",sum); else { while(sum<=21) { scanf("%d",&x); sum=x+sum; if(sum>=17&&sum<=21){ printf("%d\nYOU WIN\n",sum); break; } else if(sum>21){ printf("%d\nYOU LOSE\n",sum); break; } else continue; } } }
run
|
edit
|
history
|
help
0
Loop-worksharing
time clock and day count through seconds by ratneshgujarathi
second P
HW22
18BCE2182 ASSESS_1 Q2-2
good Job
Euclides MIRAR
day 3 integer manipulation
Text to ASCII (top)
Funciones en C