You are requested to help in writing a program to perform addition of two large number up to 50-digits. In C there is no builtin datatype for large number, but we can use characters and array to solve the problem.
Input: The input will contain two positive integers are separated by a blank, the two positive integers do not exceed 50-digits.
Output: Sum.
寫一個程式輸入兩個大數(最大50個位數),計算其總合。C語言不提供大數資料型態,但我們可以用字元和陣列來解決這個問題。
Example input:
999999999999999999999999999999 999999999999999999999999999999
Example output:
1999999999999999999999999999998
Hidden content!#include <stdio.h>#include <stdlib.h>#include <string.h>char input[500],s1[500],s2[500],temp;int i,space,sum[500],carry,temp2,flag=0;int main(){* ** * ** *** * * * ** * * * ** * * %s",&s1,&s2);