作者i4303348 (鮮橙柚)
看板FJU-Stat97A
標題[心得] do while+while 菱形星星
時間Thu Dec 17 15:57:15 2009
#include <stdio.h>
#include <stdlib.h>
int main(void)
{ int i,n,t,s,g;
do
{
printf("輸入一個整數:");
scanf("%d",&n);
i=1;
while (i<=n)
{ s=n;
while(s>i)
{ printf(" ");
s--;
}
t=1;
while(t<=i)
{ printf("★");
t++;
}
t=1;
while(t<i)
{ printf("★");
t++;
}
printf("\n");
i++;
}
i=1;
while (i<=n)
{ s=1;
while(s<=i)
{ printf(" ");
s++;
}
t=n;
while(t>i)
{ printf("★");
t--;
}
t=n-1;
while(t>i)
{ printf("★");
t--;
}
printf("\n");
i++;
}
printf("\n");
printf("要繼續嗎?? (1=yes, others=no)");
scanf("%d",&g);
}while(g==1);
system("pause");
return(0);
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.162.150
1F:推 hipringles:邱耶...根本就是謝承佑個人秀 210.61.0.94 12/17 16:36
2F:→ i4303348: 祐 114.44.129.159 12/17 16:44
3F:推 seth0921: 鼬 114.44.151.141 12/18 16:52
4F:推 a999999976: 柚 114.36.172.34 12/18 17:55
5F:→ i4303348: yo 114.44.129.159 12/18 18:00
6F:→ a999999976: 誘 114.36.169.66 12/19 15:26
7F:推 killies: 佐 119.77.242.113 12/19 15:27
8F:推 killies: 佐 119.77.242.113 12/19 15:27
9F:→ a999999976: 木 114.36.169.66 12/19 16:40
10F:→ terry0968: 洨 61.57.151.55 12/19 16:41
11F:→ a999999976: 刺 114.36.169.66 12/19 16:41
12F:→ terry0968: 郎 61.57.151.55 12/19 16:42
13F:推 killies: 大 119.77.242.113 12/19 16:43
14F:→ hipringles: 油 118.167.6.16 12/20 16:15
15F:推 seth0921: 宗 114.44.134.93 12/20 18:08
16F:推 hipringles: 零 118.167.6.16 12/21 02:45
17F:推 seth0921: ding 114.44.121.28 12/22 00:09