Created
April 9, 2015 11:10
-
-
Save imakin/12ea85b7db780b8e83b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
char A[200]; | |
char B[200]; | |
char T[200]; | |
size_t lenA,lenB,maxLen; | |
int i; | |
int digitA,digitB,digitH,carry; | |
scanf("%s",A);lenA = strlen(A); | |
scanf("%s",B);lenB = strlen(B); | |
if (lenB>lenA) | |
{ | |
maxLen = lenB; | |
for (i=0; i<maxLen-lenA; i++) | |
T[i] = '0'; | |
for (i=maxLen-lenA; i<maxLen; i++) | |
T[i] = A[lenA-maxLen+i]; | |
T[maxLen] = '\0'; | |
printf("%s\n",T); | |
printf("%s\n",B); | |
} | |
else | |
{ | |
maxLen = lenA; | |
for (i=0; i<maxLen-lenB; i++) | |
T[i] = '0'; | |
for (i=maxLen-lenB; i<maxLen; i++) | |
T[i] = B[lenB-maxLen+i]; | |
T[maxLen] = '\0'; | |
printf("%s\n",A); | |
printf("%s\n",T); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment