Created
March 27, 2019 13:14
-
-
Save ruyut/29cd0ff8eb43c08dc0ce9b45f4d2f5d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//801-2 | |
#include "stdafx.h" | |
#include<stdio.h> | |
#include<stdlib.h> | |
int main() | |
{ | |
int i, j; | |
for (i = 1; i <= 5; i++) {//從1開始,一直到5 共會出現1,2,3,4,5 | |
for (j = 6 - i; j>0; j--)//從(6-i)開始,一直到1 | |
printf("*");//列印出*號 | |
printf("\n");//換行 | |
} | |
system("PAUSE");//停住等待使用者按下任意一個按鍵 | |
return 0;//跳出 | |
} | |
/* | |
第9行 | |
for (j = 6 - i; j>0; j--) | |
i=1 , 6-1=5 , 5 4 3 2 1 | |
i=2 , 6-2=4 , 4 3 2 1 | |
i=3 , 6-3=3 , 3 2 1 | |
i=4 , 6-4=2 , 2 1 | |
i=5 , 6-5=1 , 1 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment