#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int a[2],count=0,i,t;
printf("please input three numbers:\n");
scanf("%d%d%d",&a[0],&a[1],&a[2]);
//printf("a[0]=%d",a[0]);
//printf("a[1]=%d",a[1]);
//printf("a[2]=%d",a[2]);
t=a[0]+a[1]+a[2];
for(i=0;i<3;i++){
if(a[i]==1){
count++;
}
}
//printf("count=%d",count);
if(count==0){
printf("The total value is %d\n",t);
}
else if(count==1){
if(t+10<=21)
printf("The total value is %d\n",t+10);
else{
printf("The total value is %d\n",t);
}
}
else if(count==2){
if(t+20<=21)
printf("The total value is %d\n",t+20);
else if(t+10<=21)
printf("The total value is %d\n",t+10);
else {
printf("The total value is %d\n",t);
}
}
else if(count==3){
printf("The total value is 13\n");
}
system("pause");
return 0;
}
C语言黑杰克
最新推荐文章于 2022-01-21 21:31:07 发布