LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 860|回复: 3

Basic practis ! 9*9. write code yourself!

[复制链接]
发表于 2002-11-9 10:28:03 | 显示全部楼层 |阅读模式
it's for cainiao who is learning C!

write code yourself!  i am in your sides!

1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81


maybe insist do this,you will get improve!!
 楼主| 发表于 2002-11-9 10:30:49 | 显示全部楼层
this is my first write code by myself!!
it's feels wonderful!!

CODE:
#include <stdio.h>
int main()
{int i,j;
int a;
for(i=0;i<=9;i++)
   {for(j=1;j<i+1;j++)
     { a=i*j;
      printf("%d*%d=%d ",j,i,a);
     }
    printf("\n");
   }
return 0;
}


And you can write it in your ways!    waiting for you,waiting for your improve!!
发表于 2002-11-9 11:45:30 | 显示全部楼层
Pretty good.

However I noticed that there would be an empty line at the beginning of the output.  Changing the line
for(i=0;i<=9;i++)
to
for (i = 1; i <= 9; ++i)
solve it. 8-)
 楼主| 发表于 2002-11-9 11:51:14 | 显示全部楼层
非常感谢!!!

我还有的问题是,对于,一道题目,人家给出了结果,应该从那里下手去分析算法?
对于我们没有经验的人来说,真的是一点头绪都没有!

能给我们点启发吗?
http://www.linuxsir.cn/forum.php?mod=viewthread&tid=12584

比如这类的题目!
我推了很久,由于不知道如何去分析里面的算法!

好郁闷哦!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表