九度题目1083特殊乘法

来源:互联网 发布:java面对对象经典案例 编辑:程序博客网 时间:2024/05/01 00:29
#include<stdio.h>
int main (){
       int a,b,x,ai,bi,he;
  while(scanf("%d%d",&a,&b)!=EOF){
  he=0;
  x=b;
  while(a>0){
      ai=a%10;
  a=a/10;
  while(b>0){
       bi=b%10;
b=b/10;
                    he+=ai*bi;
  }
  b=x;
  }
  printf("%d\n",he);
  }
  return 0;

}

注:记得把b的值缓存起来  以便a的各位循环中每次乘的数字一样

0 0
原创粉丝点击