博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编写程序打印如下图形_C程序打印如下设计
阅读量:2513 次
发布时间:2019-05-11

本文共 770 字,大约阅读时间需要 2 分钟。

编写程序打印如下图形

#include<stdio.h>
#include<conio.h>

void main()
{


int i,j,k,n;
clrscr(); //to clear the screen
printf(“How many lines?”);
scanf(“%d”,&n);
n*=2;

for(i=0;i<n;i+=2)
{


for(j=n-2;j>i;j-=2)
printf(” “);
for(k=0;k<=i;++k)
printf(“*”);
printf(“n”);
}

for(i=0;i<n;i+=2)
{


for(j=0;j<i;j+=2)
printf(” “);
for(k=n-1;k>i;–k)
printf(“*”);
printf(“n”);
}
getch(); //to stop the screen
}

#include<stdio.h>
#include<conio.h>

void main()
{


int i,j,k,n;
clrscr(); //to clear the screen
printf(“How many lines?”);
scanf(“%d”,&n);
n*=2;

for(i=0;i<n;i+=2)
{


for(j=n-2;j>i;j-=2)
printf(” “);
for(k=0;k<=i;++k)
printf(“*”);
printf(“n”);
}

for(i=0;i<n;i+=2)
{


for(j=0;j<i;j+=2)
printf(” “);
for(k=n-1;k>i;–k)
printf(“*”);
printf(“n”);
}
getch(); //to stop the screen
}

翻译自:

编写程序打印如下图形

转载地址:http://yrwwd.baihongyu.com/

你可能感兴趣的文章
C++基础--struct的大小
查看>>
虚树小结
查看>>
虚拟机设置静态IP地址
查看>>
Oracle表或分区导出脚本
查看>>
Springboot上传文件出现MultipartException
查看>>
NHibernate错误:Could not compile the mapping document的解决
查看>>
PHP 之微信小程序支付封装
查看>>
Dynamics CRM SQL转化为FetchXML的在线转化工具
查看>>
Dynamics CRM2011 MspInstallAction failed when installing an Update Rollup
查看>>
找老鼠啊~亏了还是赚了?
查看>>
注意Hibernate4在开发当中的一些改变
查看>>
关于vue的源码调试
查看>>
[读书笔记]java核心技术
查看>>
js 不要使用new
查看>>
g++使用container_of编译不通过
查看>>
如何用Python为你的邮箱加油?还有这种操作!
查看>>
fir.im Weekly - 8 个不能错过的 iOS / Android 技术分享
查看>>
cdoj1324暴力分块
查看>>
读《孤独六讲》
查看>>
《那些年啊,那些事——一个程序员的奋斗史》——118
查看>>