/*写的不错,也挺好动,你看下,截了个图*/
#include
#include
int
main(void)
{
int
table_size
=
0;
/*
Table
size
*/
printf("Enter
the
table
size
(from
2
to
12):
");
scanf("%d"闷模,
&table_size);
if(table_size>12)
{
printf("\nTable
size
must
not
exceed
12
-
setting
to
12");
table_size
=
12;
}
else
if(table_size<2)
{
printf("\nTable
size
must
be
at
least
2
-
setting
to
2");
table_size
=
2;
}
for(int
row
=
0
;
row<=table_size
;
row++)
{
printf("\n"世罩歼);
/*
Start
new
row
*/
for(int
col
=
0
;
col<=table_size
;
col++)
{
if(row
==
0)
/*
1st
row?
*/
{
/*
Yes
-
output
column
headings
*/
if(col
==
0)
/*
1st
column?
*/
printf("
");
/*
Yes
-
no
heading
*/
else
printf("|%4d",
col);
/*No
-
output
heading
*/
}
else
{
/*
Not
1st
row
-
output
rows
*/搜冲
if(col
==
0)
/*
1st
column?
*/
printf("%4d",
row);
/*
Yes
-
output
row
label
*/
else
printf("|%4d",
row*col);
/*
No
-
output
table
entry
*/
}
}
if(row
==
0
)
/*
If
we
just
completed
1st
row
*/
{
/*
output
separator
dashes
*/
printf("\n");
for(int
col=0
;
col<=table_size
;
col++)
printf("_____");
}
}
printf("\n");
getch();
return
0;
}
为什么拿到问题就往这里放了…枣毁…凳裤备
这样的题目多的是了……
而且还有这么多人回答……
有答案纯改有什么用,连个程序的基本算法都没有……
唉……
#include
<嫌侍薯stdio.h>
void
main()
{
int
i,j,k;
for(i=1;i<=9;i++)
{
for(j=1;j<=i;j++)
{
k=i*j;printf("%d*%d=%d
"芹者,i,j,k);
}
printf("\谈老n");
}
}