c how to program 习题3.30

发布于2020-05-09 907 热度

(a)运行结果:


(a) C语言代码:

/* c how to program 习题3.30 */
#include <stdio.h>

// function main begins program execution
int main( void )
{
    int x, y;
    int z = 1;
    while( z ){
    printf("请输入x的值(整数):");
    scanf("%d", &x);
    printf("请输入y的值(整数):");
    scanf("%d", &y);
    puts("\n运行结果是:\n");
    if (x < 10)
    if (y > 10)
    printf("*****\n");
    else
    printf("#####\n");
    printf("$$$$$\n");
    puts("");
    printf("是否再输入一次?(1/0):");
    scanf("%d", &z);
    puts("");
    }
}

(b)运行结果:


(b)C语言代码:

/* c how to program 习题3.30 */
#include <stdio.h>

// function main begins program execution
int main( void )
{
    int x, y;
    int z = 1;
    while( z ){
    printf("请输入x的值(整数):");
    scanf("%d", &x);
    printf("请输入y的值(整数):");
    scanf("%d", &y);
    puts("\n运行结果是:\n");
    if (x < 10){
    if (y > 10)
    printf("*****\n");
    }
    else{
    printf("#####\n");
    printf("$$$$$\n");
    }
    puts("");
    printf("是否再输入一次?(1/0):");
    scanf("%d", &z);
    puts("");
    }
}

记录工作,记录学习,分享知识,分享经验……