範例碼(一):C/C++ 語言 99 乘法表。
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
int main(int argc, char *argv[])
{
int x,y;
for(x=1; x < 10 ; ++x)
{
for(y=1; y <= x ; y++)
{
if(y == 1)
{
printf("%d * %d = %d",y,x,(x*y));
}
else
{
printf("\t%d * %d = %d",y,x,(x*y));
}
}
printf("\n");
}
return 0;
}
執行結果:
文章標籤
全站熱搜
