n) break; n=n-i*2; } int temp=i-2; int jishu=0; int j,k; for (j=1;j<=temp;j++){ for (k=1;k._pta l1-002">
赞
踩
#include <stdio.h> int main() { int n; char ch; scanf("%d %c",&n,&ch); n=n-1; int i; for (i=3;;i+=2){ if(i*2>n) break; n=n-i*2; } int temp=i-2; int jishu=0; int j,k; for (j=1;j<=temp;j++){ for (k=1;k<=jishu;k++){ printf(" "); } for (k=0;k<=temp;k++){ printf("%c",ch); } if(j<(temp+1)/2){ temp-=2; jishu++; } else { temp+=2; jishu--; } printf("\n"); } printf("%d\n",n); return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。