#include #include #include int main(void) { time_t loadingtime; int ans, x; srand((unsigned)time(&loadingtime)); printf("1 から 100 までの数あてクイズ\n"); ans = rand() % 100 + 1; do { printf("答えを入力してください:"); scanf("%d", &x); if ( x > ans ){ printf("もっと小さい数です。\n"); } else if ( x < ans ) { printf("もっと大きい数です。\n"); } } while ( x != ans ); printf("正解です\n"); return 0; }