C 练习实例88

C 语言教程 · 2019-02-22 15:59:21

题目:读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*。

程序分析:无。

程序源代码:

//  Created by www.codercto.com on 15/11/9.
//  Copyright © 2015年 码农教程. All rights reserved.
//

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,i,j;
    printf("请输入数字:\n");i--;
    for(i=0;i<7;i++)
    {
        scanf("%d",&n);
        if(n>50){
            printf("请重新输入:\n");i--;
        }
        else
        {
            for(j=0;j<n;j++)
                printf("*");
        }
        printf("\n");
    }
    return 0;
}

以上实例运行输出结果为:

请输入数字:
5
*****

点击查看所有 C 语言教程 文章: https://www.codercto.com/courses/l/17.html

查看所有标签

Algorithms of the Intelligent Web

Algorithms of the Intelligent Web

Haralambos Marmanis、Dmitry Babenko / Manning Publications / 2009-7-8 / GBP 28.99

Web 2.0 applications provide a rich user experience, but the parts you can't see are just as important-and impressive. They use powerful techniques to process information intelligently and offer featu......一起来看看 《Algorithms of the Intelligent Web》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具