77 || num<3){printf("Enter error!\n");prin...">
#include<stdio.h>
main()
{
int num;
while (num != 0){
if (num == 0)
return 0;
printf("Enter a number (3-77):\t");
scanf("%ld", &num);
while (num>77 || num<3){
printf("Enter error!\n");
printf("Please enter a number(3-77):");
scanf("%d", &num);
}
for (int i=0; i<=(num-1)/2; i++)
{
for (int k=0; k<=num/2-i; k++)
printf(" ");
for (int j=0; j<=2*i; j++)
printf("*");
printf("\n");
}
for (int w=0; w<=num/2; w++){
for (int m=-1; m<=w; m++)
printf(" ");
for (int n=1; n<=(num-2)-2*w; n++)
printf("*");
printf("\n");
}
}
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |