浅浅复习一下C
#include <stdio.h> #include <math.h> int main() { int num; char ch; scanf("%d %c",&num,&ch); int hangshu=(int)sqrt((num+1)/2); for(int i=0;i<hangshu;i++) { for(int k=0;k<i;k++) { printf(" "); } for (int k=0;k<2*(hangshu - i)-1;k++) { printf("%c", ch); } printf("\n"); } for(int i=1;i<hangshu;i++) { for (int j=hangshu-i-1;j>0;j--) { printf(" "); } for (int k= 0;k<2*(i + 1) -1;k++) { printf("%c", ch); } printf("\n"); } int shengyu=num-(2*hangshu* hangshu-1); printf("%d", shengyu); return 0; }
标签:ch,每天,int,num,打卡,include,第三十二 From: https://www.cnblogs.com/youxiandechilun/p/17419513.html