> printf("縦:");
> if (scanf("%d", &x) != 1) return 1;
:
> printf("横:");
> if (scanf("%d", &y) != 1) return 1;


...厳しすぎorz
(英文字入れると即死亡)