猜数游戏

/* 猜数游戏(其一:测试版)*/

#include <stdio.h>

int main(void)
{
    int no;            /* 读取的值 */
    int ans = 7;    /* 目标数字 */

    printf("请猜一个0~9的整数。

");

    printf("是多少呢:");
    scanf("%d", &no);

    if (no > ans)
        printf("a再小一点。
");
    else if (no < ans)
        printf("a再大一点。
");
    else
        printf("回答正确。
");

    return 0;
}

输出

请猜一个0~9的整数。

是多少呢:7
回答正确。
原文地址:https://www.cnblogs.com/sea-stream/p/11037420.html