Trending News
C程式語言
拜託各位大大幫我解釋一下好不好:
#include <stdio.h>
{
int i,j,h;
Printf("please input the level:");
scant("%d",&n);
for(i=0;i<=n-1;i=i+1)
{
for (j=n-2;j>=i;j=j-1)
printf(" ");
for(j=0;j<=i;j=j+1)
printf("*");
printf("\n");
}
return0;
}
(不好意思可不可以幫我一句一句翻出來~(期中報告~)
2 Answers
- 2 decades agoFavorite Answer
#include <stdio.h> 載入stdio的函式庫
{
int i,j,h; 宣告 i j k 為整數變數
Printf("please input the level:"); 在螢幕上顯示 please input the level:
scant("%d",&n); 從鍵盤輸入一個數字n
for(i=0;i<=n-1;i=i+1) for 迴圈 作n+1次的迴圈
{
for (j=n-2;j>=i;j=j-1) j=n-2當j大於等於i時則停止回圈
每做完j都會減1
printf(" "); 在螢幕顯示控格
for(j=0;j<=i;j=j+1) J=0 當j小於等於i時則停止回圈
每次做完j加1
printf("*"); 影幕顯示*
printf("\n"); 換行
}
return0; 傳回值因括號內沒有東西 所以沒有
傳回值
}
你是要這樣子嗎 如果還有哪裡看不懂 在補充吧
Source(s): 自己