#include
// 輸出九九乘法表二
使用while迴圈
int main(void) {
int i,j,sum;
i = 1;
sum = 0;
while(i<=9)
{
j=1;
while(j<=9)
{
sum = i * j;
//%02d二位數前面補零
printf("%d x %d = %02d\n",i,j,sum);
j++;
}
i++;
}
return 0;
}
//
int main(void) {
int i,j,sum;
i = 1;
sum = 0;
while(i<=9)
{
j=1;
while(j<=9)
{
sum = i * j;
//%02d二位數前面補零
printf("%d x %d = %02d\n",i,j,sum);
j++;
}
i++;
}
return 0;
}
0 意見:
張貼留言