# Batch processing Yang Hui's triangle Effect implementation code

Source: Internet
Author: User
Tags goto

This article mainly introduces batch processing printing color Yang Hui's triangle effect code, like a friend can test under

Effect Diagram: &nbsp; code is as follows: @echo Off&amp;color 0e setlocal enabledelayedexpansion mode con:cols=130 lines=130:top cls:: set/p I n= Please enter the number of rows: Set In=23&amp;set ab=1&amp;set var=64 if "%in%" = "goto top if%in% geq goto top If%in% leq 0 goto Top Echo %IN%|FINDSTR/R "^[0-9][0-9]*\$" &gt;nul 2&gt;nul| | Goto Top Set Str=1 for/l%%i in (1,1,%in%) does (&nbsp; &nbsp;set num= &nbsp; &nbsp;set num2=0 &nbsp; &nbsp;for%%a in (!s tr!) Do (&nbsp; &nbsp;set/a num2+=1 &nbsp; &nbsp;if!num2!==1 Set "str1=" &nbsp; &nbsp;set/a num1=%%a+num &nbsp; &nbsp;set " str1=!str1!!num1! "&nbsp; &nbsp;set num=%%a &nbsp; &nbsp;) &nbsp; &nbsp;call:lis"!str1:~1! "&nbsp; &nbsp;set" str=!str1 ! 0 ") Rem again output an inverted pyramid to play. FOR/L%%a in (22-1 1) do echo!nam%%a! FOR/L%%i in (1 1 3) does (&nbsp; for%%a in (a B c D E F) do (&nbsp; color 0%%a &nbsp; ping/n 2 127.1&gt;nul &nbsp;)) E Xit:lis set max=%~1 for/l%%a in (0 1) does (if not "!max:~%%a,1!" = = "" set/a ci+=1) set/a ki=var-ci/2 for/l%%a in (1 1!ki!) do set kg=!kG! Echo!kg!! max! Set nam!ab!=!kg!! max! set/a ab+=1 set Ci=0&amp;set kg= goto:eof
Related Keywords:
Related Article

## E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD