Advertisement
MUstar

IoT C언어 0419 - 새우1

Apr 19th, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int a,b,c=0;
  6.     printf("현재 존재하는 애완새우갯수 입력 :");
  7.     scanf("%d", &a);
  8.    
  9.     if(a==1) {printf("번식못함. 수고.\n");goto end;}
  10.     else if(a==0) {for (b=1;c<149;b++){c++;printf("%d일째. 현재 %d마리입니다.\n",b,c);} c+=1;goto go;}
  11.     else if (a<0) {printf("0마리이하라는 말이 되냐?\n");goto end;}
  12.     else if(a>=150) {b=1;c = 150;goto go;}
  13.     else goto cal;
  14.    
  15.     cal:
  16.     for(b=1;c<150;b++)
  17.     {
  18.         c = c+a;
  19.         printf("%d일째. 현재 %d마리입니다.\n",b,c);
  20.         c = c * c /2;
  21.     }
  22.    
  23.     go:
  24.     printf("%d일째. 현재 %d마리입니다. 어항을 바꿔주세요.\n",b,c);
  25.    
  26.     end:
  27.     printf("애완새우Love\n");
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement