Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char input[101]= {'\0'};
- int a[101]= {0},b[101]= {0},temp[100001]= {0};
- int i,j,n1,n2,t=0,d=0;
- scanf("%s",input);
- n1=strlen(input);
- for(i=n1; i>=0; i--)
- {
- a[i]=input[d]-'0';
- input[d]='\0';
- d++;
- }
- d=0;
- scanf("%s",input);
- n2=strlen(input);
- for(i=n2; i>=0; i--)
- {
- b[i]=input[d]-'0';
- d++;
- }
- for(i=1; i<=n2; i++) // เอาไว้ วิ่ง b
- {
- d=i;
- for(j=1; j<=n1; j++) // วิ่ง a
- {
- temp[d]=(b[i]*a[j])+t+temp[d];
- t=0;
- if(temp[d]>9)
- {
- t=temp[d]/10;
- temp[d]%=10;
- }
- d++;
- }
- }
- d=0;
- for(i=n1*n2; i>0; i--)
- {
- if(temp[i]!=d)
- {
- d++;
- printf("%d",temp[i]);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement