Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Lab 7 blackjack v0.9
//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); if(x<0||y<0){ printf("There are no negative cards :["); return 0; } sum=x+y; if(sum>21) printf("%d\nYou Lose\n",sum); else { while(sum<17) { scanf("%d",&x); sum=x+sum; } if(sum>=17&&sum<=21){ printf("%d\nYOU WIN\n",sum); } else if(sum>21){ printf("%d\nYOU LOSE\n",sum); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
GPS Logger || how much %
Add.c
Difference between memcpy n strncpy
PREGUNTA 2, GUÍA 4, MÓDULO 3
CALCULADORA
Area and Volume coding
300
Bitwise Xor Swaping Two Variables
Numero de veces digito
Ahora si?
stackse - search stackoverflow differently
Please log in to post a comment.