当前位置:网站首页>Printing diamond of beginner C
Printing diamond of beginner C
2022-06-11 07:52:00 【zljun8210】
Use C Language output a diamond diagram , First time study C Language , Record , The code is as follows :
/*
============================================================================
Name : Normal1.c
Author : zlj
Version :
Copyright : soft.rz
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
/* printf a pict */
int i,j,k,a,b,c;
for(a=1; a<=7; a=a+2)
{
printf("\t");
for(b=1; b<=7-a; b=b+2)
{
printf(" ");
}
for(c=1; c<=a; c++)
{
printf("*");
}
printf("\n");
}
for(i=5; i>=1; i=i-2)
{
printf("\t");
for(j=1; j<=6-i; j=j+2)
{
printf(" ");
}
for(k=1; k<=i; k++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Output is as follows :

边栏推荐
- Introduction to operations research
- Uoj 551 [unr 4] campus stroll [good polynomial questions (FOG)]
- How to prepare for the new PMP syllabus exam?
- 20200802 T3 I always like [generating function exclusion, Lagrangian inversion]
- 【集群】LVS+keepalived高可用集群
- forEach 中 return 和 for 中 break
- 2021-10-17
- 2021-11-05 definition of cache
- Zero foundation self-study SQL course | outer join external connection
- TiDB Cloud 上線 Google Cloud Marketplace,以全新一棧式實時 HTAP 數據庫賦能全球開發者
猜你喜欢

Simple configuration of vscade

Batch splice string

How to output the percent sign "%" in printf function in C language

Using Tkinter to realize guessing numbers game

TiDB Cloud 上线 Google Cloud Marketplace,以全新一栈式实时 HTAP 数据库赋能全球开发者

C language lesson 2

签到体系设计:签到功能该怎么画

Lesson 1 about Xiaobai's C language

【IoT】项目管理:如何打造更好的跨职能团队?

2021-11-05 definition of cache
随机推荐
. Net C Foundation (6): namespace - scope with name
Modular linear equations (Chinese remainder theorem + general solution)
Image processing operation record
[atcoder1984] wide swap
Alchemy experience (model training of deep learning) the necessity of timely adjusting training parameters for some situations (the adjustment of learning rate LR is the primary) summarizes some metho
C wechat upload form data
Bladed入门教程(视频)
String Simulation Implementation
Simple configuration of vscade
2021-10-24
2021-11-05 definition of cache
Black Qunhui dsm7.0.1 physical machine installation tutorial
Note: JDBC
C language Yanghui triangle code
20200802 T3 I always like [generating function exclusion, Lagrangian inversion]
Wc2020 guessing game
Tutoriel de démarrage bladed (vidéo)
C language - Growth Diary -03- function definition and function prototype declaration
134. gas station
Detailed explanation of character function and string function (including simulation implementation)