0 like 0 dislike
9.6k views

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

 

[Exercise] Coding (C) - asked in Chapter 13: Strings by (5.2k points)
ID: 40714 - Available when: 2018-01-04 18:00 - Due to: Unlimited

edited by | 9.6k views

44 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
#include <string.h>

int main()
{
* ** * * ** * * ** *** ** * a[50],b[50];
** * * * * * ** * * * *** c[51] = {0},i,x;
** ** ** **** ** * *** ***** %s",a,b);

* * * * ** ** ** ** * = 0 ; i < strlen(a) ; i++)
* * ***** * ** ** * ** * * * ** * * ** *** ** = a[strlen(a) - 1 - i] - '0';
* ****** ***** * * * *** * = 0 ; i < strlen(b) ; i++)
** **** ******** * * * * ** **** **** **** * * * += b[strlen(b) - 1 - i] - '0';
** ** * *** ** * ** * *** * = 48

* * * **** *** *** * ** = 0 ; i < 50 ; i++)
* * ** * * * **** ** *
* ** ** *** ******* * * *** *** * ** * * > 9)
* * * ** ** ** ** * ** * * *** * *** *** *
****** * * ** * * * ** *** ** *** ******* * *** * *** * * ** ***** *
* ** * * *** * * ** ******** **** * ** ** ** ** ** ** **** * = c[i] % 10;
* ****** * ** ** *** * **** * * **** *
* ** * * * * ** *

* * * * * * ** * * * = 50 ; i >= 0 ; i--)
    {
**** * * ** * * * ** **** * * *** * * * != 0)
*** **** ** * * **** ** * * ** **** ***** ** *** * *
** * ******** * *** ** ** ** ** ** ***** **** *** ** ** = i;
** ****** ** * ** ** * * * * ** ** * * ***** ***** *** *** **
* ** **** * * ** * *** * * * ** * *
* *** **** ***** * ** **

**** * * * * * * = x ; i >= 0 ; i--)
* * ***** * * * * ******** **** ** ** *** ****** *

** * * * *** ** ** ** ** 0;
}
answered by (-108 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include <string.h>

int main()
{
** ** ***** ** ** * * * * ***** * a[50],b[50];
* ****** ** ** ****** c[51] = {0},i,x;
* * ** * * * * * * * ** %s",a,b);

** * ***** **** ******** * * * * = 0 ; i < strlen(a) ; i++)
* ** **** *** *** * ** ** * ** * ** * ** * = a[strlen(a) - 1 - i] - '0';
***** ** * ** * * * * ** = 0 ; i < strlen(b) ; i++)
* * ** * ** ** * ***** ***** * * += b[strlen(b) - 1 - i] - '0';
** * * *** *** *** ** ** = 48

* * ** ****** ** * *** = 0 ; i < 50 ; i++)
* * * *** *** * *** *
* * ** ** * * ** * ****** * * * * * * * * ** * * * ** ** > 9)
* * * *** *** * * **** * * ** *** *** ** ** **
** ** * * ** ** ** * * ** * * ** ** * ** ** * * ** * ** ** * * ** *
* * * **** * * ** * * ******* * ** * * **** * * ** *** *** *** ** * ** = c[i] % 10;
** ** * **** * *** * ** * ** * *** *****
**** ***** *** * *****

****** *** *** ** * = 50 ; i >= 0 ; i--)
    {
* ******** * ** * * *** ** * *** ** *** ** *** != 0)
* * * ** * **** * ** ** * * * * * * ******
* ****** * * * *** * * * ** * ** * *** * * * ** * * ** * * * = i;
** * * *** * * * * * *** * * * * ** **** *** * * * ** ** ***
* ** *** ** * * *** ***** * ****** ***
* ** * ****** ** ***

* ** ***** * * * * = x ; i >= 0 ; i--)
***** ** **** * ** * * * * **** *** * * * *** * *** ***

** ** * * * * * * * ** 0;
}
answered by (-258 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<string.h>
int main()
{
***** * *** * * * * * *** * string1[50];
** * *** ** **** ** * * ** string2[50];

** ****** * * * * **** * * string1);
*** ** *** ** * * *** * * *** ** * *** string2);
* ** ** ** *** ** ** * * arr[51]={0},i;

* * * * * * * ****** i<strlen(string1); i++)
*** * ** ** **** * * *
* * *** ** ** ** * * ** * ** *** * * * * ** += string1[strlen(string1) - 1 - i] - 48;
    }

* ** * * * * *** * ** i<strlen(string2); i++)
** ** * * ** * * ** *
** * ** * * * ** **** * * * *** * ***** * ** ** += string2[strlen(string2) - 1 - i] - 48;
******* ** * * ** * **

***** *** ** *** ** * **** i<50; i++)
* ** ** ****** ** *
* * * * * *** ** ** *** * * *** ** * * ** * > 9)
* * *** * * *** *** ** *** ** * * * * * *
* * * ** ****** * ** ***** * ***** * * *** ** * *** * * **** * * * -= 10;
** * *** *** * ** * * * * ** * * * ** * * * **** * ** ***** * * ** * *
** * *** ** ** * * * ** * * * ***** * * * * ****
* * * * *** *** ** *

* * **** * ** * * ** * i>=0; i--)
** ** * ** * ** * ****
* * *** * ** ** ** * * * * * ** * * * *** * * * != 0)
* ** * ****** * * * * ***** *** ** * * * * * * * ****** **** * * *** *
* * * *** * *** ** *

*** * * *** ******** * * * * i--)
* * * * * * *** ** ** * *** * ** * * * *** * ** ** arr[i]);
}
answered by (-323 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include <string.h>

int main()
{
* **** * * ** ****** * a[50],b[50];
** * * *** **** ****** * * c[51] = {0},i,x;
***** ****** ** * ** * * ** *** %s",a,b);

** *** * * *** ** ** = 0 ; i < strlen(a) ; i++)
*** * *** ** ****** *** * *** ** ** * * ** *** * = a[strlen(a) - 1 - i] - '0';
*** * ** * ** *** ****** ** = 0 ; i < strlen(b) ; i++)
*** * * * *** **** * *** ** ** ** * ** ** ** += b[strlen(b) - 1 - i] - '0';
* ** * ** * *** = 48

** * * *** * * * = 0 ; i < 50 ; i++)
** * * * ** ** *****
* **** ** **** ** * * ** *** * *** * * * > 9)
** ***** ****** *** ** ******* * * **** * ** ***
** * ** ** *** * *** ** ** * ** * * * *** ***** ** ********** * * **
** **** * * * ** * * * * ** ***** * * ** ** * ** **** ** *** = c[i] % 10;
* *** *** ** ** **** ***** * * ** * ******* *
** * * * * *** * ****

***** *** * ** * * * ** **** = 50 ; i >= 0 ; i--)
    {
* *** * ** ** ** ** ** * *** * ** * ** ** ** * != 0)
**** * * * * * * ** * **** * ******
* * * * ****** **** * *** * * *** ***** ** * * * ***** * * * ** **** = i;
* ** ** *** * *** * ** * * * * * ** * * * ** **** * ** * * * *** *
*** ***** *** * ***** * **** ** * * * ***
* ** * * * *

** * ** ** * * = x ; i >= 0 ; i--)
** **** * * *** *** * ** * * * * * * * * * ****** * **** ***

** * *** ** * ******** * ** 0;
}
answered by (-127 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include <string.h>

int main()
{
*** * * * * ** * ** * a[50],b[50];
* **** * * **** c[51] = {0},i,x;
**** ** * ** * ****** * ** %s",a,b);

*** * *** * * *** ** **** ** = 0 ; i < strlen(a) ; i++)
** * * ******** **** ** * * * * * * ***** * = a[strlen(a) - 1 - i] - '0';
* ** * ** * ** * ** ** * *** = 0 ; i < strlen(b) ; i++)
* * ** * * ** * * ** * ** * * ******* * * += b[strlen(b) - 1 - i] - '0';
* ** * * * * ****** = 48

* ** **** **** * * * *** = 0 ; i < 50 ; i++)
** * ** * * *****
* * ** * * ** * * * **** *** * * **** > 9)
* *** *** ** ****** * * *** ** ********* *
** **** ****** * ** *** *** * * * * * * * * ** * * * * ** ** * *
*** ****** * ** ****** ******* *** ** ** * * * * **** ** ****** * = c[i] % 10;
** ***** * ** ** * ** * * * ** **** *
* * ** ** *** ****

** *** * ** * ** * *** * = 50 ; i >= 0 ; i--)
    {
**** * * * * ** ** ***** **** * * * != 0)
** ** * * ** ****** * ****
** * * ** * *** **** * ** * *** * ** * * * * *** * **** *** ** * ** * = i;
*** *** *** *** *** *** * ** * ** *** * ** ** ** ** ***** ** ** *
* *** * ** ** * * * **** ** *** ***** ** ****
* *** *** *** ** * ** **

**** * ** ** *** * * * * = x ; i >= 0 ; i--)
** *** * * ** * * ***** ** *** ** * **** ** ** * ** ***** *

* ** * **** *** ** * ** * 0;
}
answered by (-255 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
**** * *** * ****** ** num1[255], num2[255], sum[255];
* * **** ***** ** *** *** *  s1[255], s2[255];
***** ** ******* * * * l1, l2;

* ******** ***** *** ** * ** * %s", &s1, &s2);

** * * * * ** **** ** (l1 = 0; s1[l1] != '\0'; l1++)
**** ****** ** * * * * **** *** * * * * * ** = s1[l1] - '0';

* ***** ** * ** * ***** (l2 = 0; s2[l2] != '\0'; l2++)
** ** ** ** * ** * * * ***** * * * * * * * = s2[l2] - '0';

***** **** **** * * * *** carry = 0;
* * * ** * ** * k = 0;
** *** ** ** ** * i = l1 - 1;
* * * * *** * *** * * j = l2 - 1;
* ** *** * * ** ***** (; i >= 0 && j >= 0; i--, j--, k++)
* * * ** ** * * *
* *** * * * * * * ***** * * ** *** ****** *** = (num1[i] + num2[j] + carry) % 10;
** **** * ** * * * * ****** * ** *** * **** * * = (num1[i] + num2[j] + carry) / 10;
* * **** ******
** *** ** ** * * ** * (l1 > l2)
* ****** * * * * *

**** *** ** **** * * * * * **** ** *** * * * ** ** (i >= 0)
** * ***** *** ** * * ** * * ** * * ** * ** *
** ** *** ** ** ** ** **** *** ** * * **** *** * * *** ** * ** *** * * * = (num1[i] + carry) % 10;
**** ***** **** * ** ***** **** ** * **** * *** *** ** ** * * * = (num1[i--] + carry) / 10;
* * ** * ** * * * ** *** ** *** *** *** *
* ** ** **** ** * ** *** * ** * * *** * * ** **
**** **** * ******* * ** * * * ** ** *** * * * *** ** * * * *** * ** ** ****

* ** ** * ** * * * **
* * * * **** ** * *** **** if (l1 < l2)
* *** ** * * * **** * **
** ***** * * * * ***** ** *** ** * * ** *** * ** ** (j >= 0)
** * ** *** * ***** ** * **** * ** *** *******
**** * * ** ** ** * ******* ** * ** ** * ** ** * * ** ** * * = (num2[j] + carry) % 10;
* ** * * * * * *** * * ** * ** ***** * ** * *** * * * * * * = (num2[j--] + carry) / 10;
**** ** ** ** * * * ******* ** ** * *** * **
**** * * ** * * ** **** **** ** * * * *** *
* * * * * * * * *** ** ** * ***** ** ** * ** * ** * * * *
** ** * *** ** * *
* ** **** ** **** * * *
* *** * *** * ** **** **
** *** * ** * * * ** * * * *** ** ** * * (carry > 0)
***** **** ***** ** ***** * * **** ** **** * ** * ** = carry;
    }

** ** ** * * * **** * (k--; k >= 0; k--)
* ** *** ** * * * * * * * ** ** * * *** *** * * * sum[k]);

* * * ******* ** * * 0;
}
answered by (-168 points)
0 0
prog.c: In function 'main':
prog.c:8:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[255]' [-Wformat=]
     scanf("%s %s", &s1, &s2);
             ^
prog.c:8:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[255]' [-Wformat=]
     scanf("%s %s", &s1, &s2);
                ^
0 like 0 dislike
Hidden content!
** * * * **** * ***
int main()
{
** ** ** ** * ** ** ** num1[255], num2[255], sum[255];
** *** * *** * * * * ** s1[255], s2[255];
* * * * *** ** ** * * *** l1, l2;

* * *** *** ** *** ** * * %s", &s1, &s2);

***** * ** * * * * *** (l1 = 0; s1[l1] != '\0'; l1++)
** * ** * *** *** **** * ** * * ** ** ** ** *** = s1[l1] - '0';

*** *** * * * *** (l2 = 0; s2[l2] != '\0'; l2++)
** ** ** *** * **** *** * ******* * * * * * * * * * = s2[l2] - '0';

* **** * ***** * ** **** * * carry = 0;
*** * *** ** * *** k = 0;
* *** * ** ***** * ** i = l1 - 1;
* * *** ** *** * ** * ** * * j = l2 - 1;
* * * * ** **** * * (; i >= 0 && j >= 0; i--, j--, k++)
* *** * ** *** * *
** * * * * * *** * * *** **** * * * *** = (num1[i] + num2[j] + carry) % 10;
*** ** ** ** * *** * * *************** ** * = (num1[i] + num2[j] + carry) / 10;
** * * * * * ** * **
* ** * * * * * * **** (l1 > l2)
* ******* ***** ***** * ** * *

** **** * * ****** * *** *** ** **** *** (i >= 0)
* **** * * * * * ** ** ** ** *** ***
* * **** ** ** ** ** * * * * ** * ** **** *** * ******* * ** *** = (num1[i] + carry) % 10;
** ** ***** * * * ***** ** * * **** * * ******* * ** * **** = (num1[i--] + carry) / 10;
* ** * * ** **** **** ***** * * ** ****

* *** ** * * *****
**** * * * * ** * ** **** * * ** if (l1 < l2)
** *** * *** ** **** ***
* * * * * * *** * * * * * ****** *** ** * **** ** (j >= 0)
** ** * **** **** *** * * * ** * ** *
****** ** * ***** ** ** * * * **** ** * ** *** ** * * ********* * * * * * * = (num2[j] + carry) % 10;
* * * ** ** ** ** ** * * * ** ** * ***** * * * * ** * * = (num2[j--] + carry) / 10;
* * * * ** * * * ** * ** ** * ***
*** * *** ** ** ***
** ** * *** * * * ** **
* **** ** *****
** ** * * * * *** ** * **** * * ** *** ** (carry > 0)
* ** ** **** ** **** * **** *** ** ** ** * * ** * ** * * *** = carry;
***** ** ** **** * **

** ** * *** *** * * ** (k--; k >= 0; k--)
* * * * * *** **** * * ***** ** * ** **** ** *** ** * sum[k]);

**** * * ** ** ** * * * 0;
}
answered by (-168 points)
0 0
prog.c: In function 'main':
prog.c:8:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[255]' [-Wformat=]
     scanf("%s %s", &s1, &s2);
             ^
prog.c:8:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[255]' [-Wformat=]
     scanf("%s %s", &s1, &s2);
                ^
0 like 0 dislike
Hidden content!
* ** ** * * **
*** *
{
* * * ** * * int *** * **
*** * *** * ** * *
*** * * * * int l1, l2;


***** **** ** ** ** * * * * * *
** * **** *
* * ***
* *** * * * for (l1 = 0; * != * ** *
* ** * **** *** ** ***** * = * - **
* *** * ** *
* *** * *** * for (l2 = 0; *** != **
* ** * * ** ** * ** = * - *
* ** ** *
** *** *** = 0;
* * ** * ** int k = 0;
* * * *** int i = l1 - 1;
** * *** * j = l2 - 1;
* * ** **** for (; i **** 0 * * * j 0; * * *
** * *** * * * *** {
* * ** ** * * ** ***** ** = * * + * + * * % 10;
** * * * * ** ***** * * = ** + + *** / 10;
**** ** * * * * * }
**** ** * * * if (l1 * ** l2)
* ** * * ** {
**** ****
** ** * ** * * (i * ** 0)
*** ** * * ** * * *** ** * ** {
*** ** * * * *** * * *** * *** ** = * + * % 10;
* * ***** * ** * * * ** *** * * ** = ** ** + ** / 10;
*** * ** * *** ** * *** * ** ** ** }
* * ** * ***
* * * * * }
**** **** * * if (l1 **** l2)
** ** * * * * **
* *** * * ** * * ** (j * ** 0)
* * * * ** *** * * * **** *** *** {
*** * ** * * * ** ** * *** ******** ** * = * + * % 10;
** *** * * * * ** * * ** * ** = ** + / 10;
*** ** ** * *** ** *** ** * }
* * ** *** ** }
* * * *** *
* * * * * ** *** ** *
**** ******* * * * * ** * * if ** 0)
***** * *** * ** ** ** * * ** = *
**** * ** *** * *



**** * * * ** for k ***** 0; *
* * **** * * * **** ****** ** * * *
**** * * **
***** * * *** * 0;
}
answered by (-304 points)
0 0
prog.c: In function 'main':
prog.c:9:10: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[50]' [-Wformat=]
  scanf("%s %s", &s1,&s2);
          ^
prog.c:9:13: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[50]' [-Wformat=]
  scanf("%s %s", &s1,&s2);
             ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
******** *** * * * * *** num1[200], num2[200], sum[200];
* * * ** * ** ** s1[50], s2[50];
** * **** ** ***** * * *** ** i, j;
* * **** * * * * ** carry = 0;
* * *** * * ** * *** k = 0;
*** **** ***** ** * ** **
***** * *** ** ** * ****** ** * * s1);
* * * ** * * * * * * **** **** * ** * s2);
* * * *** ** * * ** ** *
* ** * ** * * **** (i = 0; s1[i] != '\0'; i++)
* * ** ** *** ** * ***** ******* * ***** **** = s1[i] - '0';
** * *** ** ** * ***
*** * ** * ** * *** ** (j = 0; s2[j] != '\0'; j++)
** * ** ** * ** * ******** * * ** ** ** **** * * = s2[j] - '0';
* * * * ** ** ** * *
* * ***** ** *** ** m = i - 1;
** * * ** * *** **** n = j - 1;
****** * ***** * ****
* ***** ** * * * ** (; m >= 0 && n >= 0; m--, n--, k++)
* * *** ** * ***
* *** *** *** * * **** * *** ** ****** * * ** = (num1[m] + num2[n] + carry) % 10;
* ** * * ** * ** * ***** ** ***** **** * = (num1[m] + num2[n] + carry) / 10;
** * *** **** ** * ** *
* *** * ** ***** ** (i > j)
** ** * *** * * ** *
* * * * ** ** ******** *** * ** * * ** * (m >= 0)
* * *** * * * * * **** * ***** * ** ********
* * * ** *** ** ** * **** * * * * ** *** ** * ** * ** ******* * = (num1[m] + carry) % 10;
** * ** ** * * * ** **** ** ****** *** * * * * **** * *** ** * * **** * **** * * = (num1[m--] + carry) / 10;
* ** * ** ** ***** * *** * *** * ** *
* *** ***** **** ** *** **** * ***
** **** *** ** * ** else if (i < j)
* *** * * * ** * * **
** * * * * ** * * ** *** ** * * * * (j >= 0)
* *** * * * * ** ** * *** * * *** * * * *
* * * ** * * **** * *** * * * * * ***** *** * ** * **** * **** * = (num2[n] + carry) % 10;
*** * *** * **** * * * * **** *** * ** * *** * * * * ** ** ** * = (num2[n--] + carry) / 10;
******** * ** ***** * * * *** **** ***
*** **** **** * * *** else
** *** *** * ** ** *
* ***** * * * **** * * * ** ** * ** * * * (carry > 0)
* * ** *** ** * **** * *** **** ***** ** *** * * ***** * * * * ****** ** ** ** = carry;
* ** *** **** * *** *
** * * * * ***** *** **
* ** ** ** *** * * ** * * (k--; k >= 0; k--)
* ** ** **** ** ** ** * ** * * ** * ** * * ** *** * * sum[k]);
    
* * * *** * ** **** *** 0;
}
answered by (-193 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main() {
**** * ** ** ** * * ** num1[100], num2[100], sum[100];
* ** ** *** * * s1[50], s2[50];
**** ** * * * * * * ** ** l1, l2;
* * * * ** * ***
* ** ** ** * * * * ** *
* **** *** * * ** **** *** * * ** *** s1);
** *** ** * * * * * * * ** *** ** *** * s2);
**** * *** * * ***** **
* * ** * * * * *** *** (l1 = 0; s1[l1] != '\0'; l1++)
* ** * * * * ** * * ** * ** *** * * * * = s1[l1] - '0';
*** * *** ******** ** * **
** *** *** * *** **** * (l2 = 0; s2[l2] != '\0'; l2++)
*** * * *** * **** ** * ** * * * * * ** * * = s2[l2] - '0';
* ** * * ** ** **
** ** * ********* * ** carry = 0;
** * ** ** * ** ****** k = 0;
** * * ** * * ** i = l1 - 1;
* * ** * * * *** * * * * j = l2 - 1;
* * * *** *** (; i >= 0 && j >= 0; i--, j--, k++) {
* ** * ** *** * *** *** * ** * ** * *** * = (num1[i] + num2[j] + carry) % 10;
*** * ** ********* * * * * ** ** * **** *** ** ** = (num1[i] + num2[j] + carry) / 10;
* **** * *** *** ** * *
* * * **** * * ****** *** (l1 > l2) {
* ** **** * ***** * * *** * *** *** * *** *
* ** * **** ** * * * * ** * *** **** * * * * (i >= 0) {
* * ** *** * ** * ** * * *** ** **** * * ** * * * * ** * * = (num1[i] + carry) % 10;
* **** * *** * ** * ** ** ** ****** ****** * * * ** * * * *** = (num1[i--] + carry) / 10;
** *** ** * * ** * * * *** * * ** ***
** * * ** * ** * ** * * * * *** ** *** * *
* *** * * * * * else if (l1 < l2) {
** * ** *** * * * *** * * * ** ******* (j >= 0) {
* *** * * ** * * * ** ** * *** ** ***** *** ** * * *** ** * * ****** * = (num2[j] + carry) % 10;
* ** * * * ** ** * * **** * *** * *** * *** * **** ** = (num2[j--] + carry) / 10;
* * ******** ******* ** *** *** * * ** ** * ***
* * * ** ** * * * ** * * * *** else {
** ** ** ** * ** *** * * *** (carry > 0)
*** *** * ** * **** ** * ****** ** * ** *** * ** ** * * *** = carry;
** ** * * ** * * ** * * *
** ** **** *** * * * * *
** * * *** ***
** * * ** * * (k--; k >= 0; k--)
* ** * *** * ** * ** *** *** ** ** ** ** sum[k]);
* **** * *** ** * ** **
* ** * *** ** * * 0;
}
answered by (323 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.130.70
©2016-2025

Related questions

1 like 1 dislike
85 answers
[Exercise] Coding (C) - asked Oct 26, 2017 in Chapter 6: Loops by semicolon (5.2k points)
ID: 28914 - Available when: 2017-10-26 18:00 - Due to: Unlimited
| 16.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users