cndcg1994 - 2008-10-11 9:52:00
问题:用pascal语言编写输出99乘法表
利用for循环:
Program jojo_dcg;
Var b,a,c:integer;
Begin
c:=0
for a:=1 to 9 do
begin
for b:=1 to i do
write(a,'*',b,'=',a*b:2,' ');
c:=c+1
if (c=1) or (c=3) or (c=6) or (c=10) or (c=15) or (c=21) or (c=28) or (c=36) or (c=45)
then writeln;
end;
readln;
end;
但是输出有错误
没有1*1 2*2 3*3 4*4 5*5 6*6 7*7 8*8 9*9
利用while循环:
Program jojo_dcg;
Var a,b,c:integer;
Begin
a:=a+1
While (a>=1) and (a<=9)
Begin
b:=b+1接下去
利用repeat循环
本人是初中生不要编写太专业谁可以帮我?
用户系统信息:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
东嬉南北 - 2008-10-11 10:59:00
:default16: c的可以么?你大概看下思想和结构~p的不太熟悉……
#include "stdio.h"
int main(void)
{
int i,j; /*i是行,j是列*/
for(i=1;i<=9;i++)
printf("%7d",i);
printf("\n");
for(i=10;i<=76;i++)
printf("%c",'-'); /* 输出“-”线*/
printf("\n");
for(i=1;i<=9;i++){
for(j=1;j<=i;j++)
printf("%d*%d=%d",i,j,i*j); /*输出每行乘以每列的结果*/
printf("\n");
}
return 0;
}
没有vc++也不知道好用不,大概就是这样了……
牛仔馒头 - 2008-10-11 17:07:00
恩,机是,楼上说的,用C,C++都可以,,不要用那么笨的语言,,另外楼上的,在,定义这个函数的时候,int main() main 是,关键字,不能用做定义函数的,请多多指教
猎豹一号 - 2008-10-11 21:36:00
原帖由 牛仔馒头 于 2008-10-11 17:07:00 发表
恩,机是,楼上说的,用C,C++都可以,,不要用那么笨的语言,,另外楼上的,在,定义这个函数的时候,int main() main 是,关键字,不能用做定义函数的,请多多指教
想你对C不是很了解,C只有一个主函数main(),必须有。

Program jojo_dcg;
Var a,b,c:integer;begina:=a+1;
while (a>=1) and (a<=9)
begin
b:=b+1;
repeat
write(a,'*',b,'=',m*n:2,' '); writeln; until b=9; end; readln;end.在delphi编程时了解少少pascal 语言,勉强编出来,不知道对不?初中生就学pascal语言了?
© 2000 - 2025 Rising Corp. Ltd.