main()
{
int A, B;
for (A = 1; A < 10; A++)
{
for (B = 9; B > A; B--)
{
printf(" ");
}
for (B = 1; B <= A; B++)
{
printf("%d", B);
}
for (B = B - 2; B > 0; B--)
{
printf("%d", B);
}
printf("\n");
}
getch();
}
อันนี้เปลี่ยนเป็น คำสั่ง while ให้ผมหน่อยครับ
main()
{
int intLoop1, intLoop2, intCount;
printf("Enter Number : ");
scanf("%d", &intCount);
printf("\n");
for (intLoop1 = 1; intLoop1 <= intCount; intLoop1++)
{
for (intLoop2 = 1; intLoop2 <= intLoop1; intLoop2++)
{
printf("*");
}
printf("\n");
}
getch();
}
อันนี้ก็เปลี่ยนเป็นคำสั่ง while เช่นกันครับบบ
ขอบคุณมากนะครับผมมม
บ๊ายบายยย
{
int A, B;
for (A = 1; A < 10; A++)
{
for (B = 9; B > A; B--)
{
printf(" ");
}
for (B = 1; B <= A; B++)
{
printf("%d", B);
}
for (B = B - 2; B > 0; B--)
{
printf("%d", B);
}
printf("\n");
}
getch();
}
อันนี้เปลี่ยนเป็น คำสั่ง while ให้ผมหน่อยครับ
main()
{
int intLoop1, intLoop2, intCount;
printf("Enter Number : ");
scanf("%d", &intCount);
printf("\n");
for (intLoop1 = 1; intLoop1 <= intCount; intLoop1++)
{
for (intLoop2 = 1; intLoop2 <= intLoop1; intLoop2++)
{
printf("*");
}
printf("\n");
}
getch();
}
อันนี้ก็เปลี่ยนเป็นคำสั่ง while เช่นกันครับบบ
ขอบคุณมากนะครับผมมม
บ๊ายบายยย