View Code of Problem 13

#include <stdio.h>
int main(){
  int h,a,b,k;
  int i=1;
  int flag;
  while(scanf("%d %d %d %d",&h,&a,&b,&k)!=EOF){
  	flag=1;
    while(k>0){
  	h=h-a;
      if(h<1){flag=0;break;}
      else h=h+b;
      k--;
    }
    if(flag==1){printf("Case #%d: Unknow\n",i);i++;}
    else{printf("Case #%d: White win",i);i++}
  }
  return 0;}
/*
Main.c: In function 'main':
Main.c:15:45: error: expected ';' before '}' token
     else{printf("Case #%d: White win",i);i++}
                                             ^
*/

Double click to view unformatted code.


Back to problem 13