SDUT-2561 九九乘法表
来源:互联网 发布:windows凭据 编辑:程序博客网 时间:2024/05/16 16:17
九九乘法表
Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic Discuss
Problem Description
九九乘法表是数学学习的基础,今天我们就来看看乘法表的相关问题。《九九乘法歌诀》,又常称为“小九九”,如下图所示。你的任务是写一个程序,对于给定的一个正整数 n ,输出“九九乘法表”的前 n 行。例如,输入 n 为 9,你的程序的输出将为下图:
Input
输入包含多组测试数据,以 EOF 结束。每组测试数据只包含一个正整数 n (0 < n < 10)。
Output
对于每组测试数据,输出上图所示“九九乘法表”的前 n 行。
Example Input
23
Example Output
1*1=11*2=2 2*2=41*1=11*2=2 2*2=41*3=3 2*3=6 3*3=9
Code
#include<stdio.h>int main(){ int row,col,n; while(scanf("%d",&n)!=EOF) { for(row=1; row<=n; row++) { for(col=1; col<=row; col++) { printf("%d*%d=%d",col,row,row*col); if(col!=row) printf(" "); } printf("\n"); } } return 0;}
1*1=11*2=2 2*2=41*1=11*2=2 2*2=41*3=3 2*3=6 3*3=9
#include<stdio.h>int main(){ int row,col,n; while(scanf("%d",&n)!=EOF) { for(row=1; row<=n; row++) { for(col=1; col<=row; col++) { printf("%d*%d=%d",col,row,row*col); if(col!=row) printf(" "); } printf("\n"); } } return 0;}
阅读全文
0 0
- SDUT-2561 九九乘法表
- 九九乘法表 (sdut oj)
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 九九乘法表
- Nginx 官方历史版本
- Android Cavas.clipPath()用法
- Shell—eval命令使用
- 安装并使用 Wowza 发布你的 RTMP 直播流
- CMake在安装了VS2015和VS2012的时候,选择VS2012作为编译器
- SDUT-2561 九九乘法表
- 基于MVP设计模式的感想
- JAVA中最常用的十个快捷键
- Activity的启动模式
- aidl在android studio中创建的另类方式
- JS之获取指定位置Unicode的charCodeAt()方法
- docker容器和Linux的一些指定,以便自己查阅
- BaseRecyclerViewAdapterHelper的使用
- 常用控件之ImageView