Skip to content

Instantly share code, notes, and snippets.

@ruyut
Last active March 27, 2019 13:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruyut/e8abc9b5f12b1f7fc20a1c24b1dc17fa to your computer and use it in GitHub Desktop.
Save ruyut/e8abc9b5f12b1f7fc20a1c24b1dc17fa to your computer and use it in GitHub Desktop.
//801-1
#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 = 0; j<i; j++)//從0開始,一直到i的前一個
printf("*");//列印出*號
printf("\n");//換行
}
system("PAUSE");//停住等待使用者按下任意一個按鍵
return 0;//跳出
}
/*
第9行
for (j = 0; j<i; j++)
i=1 時 0
i=2 時 0 1
i=3 時 0 1 2
i=4 時 0 1 2 3
i=5 時 0 1 2 3 4
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment