請輸入 1 5
顯示如下
___1____2____3____4____5
1___1_____2____3____4____5
2_________4____6____8___10
3______________9___12___15
4__________________16___20
5_______________________25
請各位幫個忙,老師出這種題目我還沒看過,希望大大幫個忙
(底線為空白處)
謝謝
2007-10-30 11:38:55 · 3 個解答 · 發問者 煜 1 in 電腦與網際網路 ➔ 程式設計
因為很急所以希望有看到的高手幫忙傳一下,謝謝
2007-10-30 11:41:14 · update #1
是輸入1__5
(底線是空白),不是輸入15,謝謝
2007-10-30 11:42:28 · update #2
如果是要在linux的Shell Script裡面顯示出來的話,要打什麼才能顯示出來呢,謝謝
2007-10-30 12:51:45 · update #3
要在linux的Shell Script裡面打程式然後要顯示出來,不是打指令顯示出來,謝謝
2007-10-30 15:31:48 · update #4
#include
void main () {
int i=0,j=0,k=0,m=0,n=0;
scanf("%d%d",&m,&n);
printf(" ");
for(i=m;i<=n;i++)
printf(" %d",i);
printf("\n");
for(i=m;i<=n;i++){
printf("%d ",i);
for(j=1;j<=n;j++){
if(j
printf(" ");
else{
if((0<=i*j)&(i*j<10))
printf(" ");
else if((10<=i*j)&(i*j<100))
printf(" ");
else if((100<=i*j)&(i*j<1000))
printf(" ");
else if((1000<=i*j)&(i*j<10000))
printf(" ");
printf("%d",i*j);
}
}
printf("\n");
}
}
2007-10-30 21:06:18 補充:
關於你說的linux的Shell Script這方面我不是很清楚...可能沒有辦法正確的回答你了..抱歉...
2007-10-30 12:29:39 · answer #1 · answered by 小白 5 · 0⤊ 0⤋
#include
#include
#include
int main(int argc, char* argv[]){
//=====START=====//
int min,max,i,j;
char tmpf[32767],buffer[32767];
printf("Input two numbers: "),scanf("%d %d",&min,&max);
for(i=0;i<(max-min+2);i++){
printf("%2s",(i>0?itoa((min+i-1),buffer,10):""));
for(j=0;j<(max-min+1);j++){
strcpy(tmpf,(i>0?"":(j>0?"":" ")));
itoa((i>0?(min+i-1)*(min+j):(min+j)),buffer,10);
strcat(tmpf,buffer);
printf("%4s",(i>0?(j>=(i-1)?tmpf:""):tmpf));
}
printf("\n");
}
//=====END=====//
system("PAUSE");
return 0;
}
2007-10-30 17:05:39 · answer #2 · answered by Big_John-tw 7 · 0⤊ 0⤋
./a.out
2007-10-30 12:57:51 · answer #3 · answered by Xiao Lan 4 · 0⤊ 0⤋