#include <stdio.h>
int main (void )
{
int numStar = 1 ;
int i, j;
for (i = 1 ; i <= 4 ; i++) {
for (j = 1 ; j <= 4 - i; j++) {
printf (" " );
}
for (j = 1 ; j <= numStar; j++) {
printf ("*" );
}
printf ("\n" );
numStar += 2 ;
}
numStar = 5 ;
for (i = 1 ; i <= 3 ; i++) {
for (j = 1 ; j <= i; j++) {
printf (" " );
}
for (j = 1 ; j <= numStar; j++) {
printf ("*" );
}
printf ("\n" );
numStar -= 2 ;
}
return 0 ;
}
# include <stdio.h>
int main (void)
{
printf(" *\n ***\n *****\n* ******\n *****\n ***\n *\n ");
return 0;
}
#include<stdio.h>
int main(void )
{
int i, j, k, line;
printf ("请输入打印的行数(奇数):" );
scanf ("%d" , &line);
for (i = 0 ; i <= (line - 1 ) / 2 ; i++) {
for (j = 1 ; j <= (line - 1 ) / 2 - i; j++) {
printf (" " );
}
for (k = 0 ; k <= 2 * i; k++) {
printf ("*" );
}
printf ("\n" );
}
for (i = 1 ; i <= (line - 1 ) / 2 ; i++) {
for (j = 1 ; j <= i; j++) {
printf (" " );
}
for (k = 1 ; k <= line - 2 * i; k++) {
printf ("*" );
}
printf ("\n" );
}
return 0 ;
}
/* 因数分解 24 =2 *2 *2 *3 */
int main()
{
int num,i=2 ;
printf ("请输入大于等于2的数:" );
scanf("%d " ,&num);
while (num<2 ) {
printf ("请输入大于等于2的数:" );
scanf("%d " ,&num);
}
printf ("%d =" ,num);
while (num>1 ) {
while (num%i ==0 ) {
printf ("%d " ,i);
if (num/i!=1 )
printf ("*" );
num=num/i;
}
i++;
}
printf(" \n");
return 0;
}