题目描述
写个算法,对2个小于1000000000的输入,求结果。特殊乘法举例:123 * 45 = 14 +15 +24 +25 +34+35
输入
两个小于1000000000的数
输出
输入可能有多组数据,对于每一组数据,输出Input中的两个数按照题目要求的方法进行运算后得到的结果。
样例输入
24 65
42 66666
3 67
样例输出
66
180
39
代码
#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d %d",&a,&b) != EOF)
{
int b1=b;
int sum=0;
while(a!=0)
{
int temp=a%10;
while(b!=0)
{
int temp1=b%10;
sum+=temp*temp1;
b=b/10;
}
b=b1;
a=a/10;
}
printf("%d\n",sum);
}
return 0;
}