fjnu 1405 编制一个乘法运算的程序

来源:互联网 发布:创维21d9bh数据下载 编辑:程序博客网 时间:2024/05/29 02:37
 

Description

从键盘读入两个100以内的正整数,进行乘法计算并输出

Input

该题有多组测试数据,每组数据为一行,包含两个乘数,用空格分开。

Output

输出格式请看样例.注每一行末尾没有任何空格,比如样例数据中的89后面没有空格。

Sample Input

89 13

 

Sample Output

     89*    13-------    267    89-------   1157
KEY:打印题,注意输出就可以了,后面别多空格;
Source:#include<iostream>
#include
<cstdio>
using namespace std;

void mul(int a,int b)
{
    
int t1=0,t2=0,c;
    t1
=a*(b%10);
    t2
=a*(b/10);
    c
=a*b;
    printf(
"%7d ",a);
    printf(
"*%6d ",b);
    printf(
"------- ");    
    
if(b>9)
    
{
        printf(
"%7d ",t1);
        printf(
"%6d ",t2);
        printf(
"------- ");      
    }

    printf(
"%7d ",c);
}


int main()
{
    
int a,b;
    
while(cin>>a>>b)
    
{
        mul(a,b);
    }

    
return 0;
}