0 like 0 dislike
7k views

Question 9: Please a write a program that receives a set of numbers, then outputs the summation of those inputs.

Input1

3
1 2 3

Output 1

6

 

Input2

5
-1 -1 -1 0 0

Output2

-3

 

Input3

2
-1 5

Output3

4

 

[Exam] asked in Final examination by (5.9k points)
ID: 41968 - Available when: Unlimited - Due to: Unlimited
| 7k views

21 Answers

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

int main(int argc, char *argv[]) {

** * * *** ** * size;
** **** * * ** * ** sum;
* ***** * * ** * * * ** *** * * * ****** * * &size);
* * * * * *** * * * *
* *** ** * * * **
*** *** ** * * ** * * ** a[size];
* ** ***** * * ** *** * i;
   
   
* * * * * * ***** **** ***** ** * *
*** ** * * * * * ***** * *** ** ** ** * ** ***** ** ** ** **** *** *** ** * * ** * **** * * * * **** **** ** * *** ** ** * ** **** * * **** *** ** ** * *** *
**** ** * * *** ** * * *** * * ***** ** * **** * * ** **** **** *** * ** *** ** ** * ** * *** * * * * * *** * * * ** **** ** *** **** *** *
* *** **** * * * ***** ** ** * ** *** sum);
** ** * * ** * * *
    ** *** * ** * *** ** ***
* * ** * * ** * * * 0;
}
50/100 answered by (221 points)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {

***** ** * ** * ** ** size;
* * ** **** * * **** * sum;
* *** * *** ****** * * ** * ** ** ** * * &size);
* **** * * *** *
** * *** * * *** * * ** *
**** * * *** ** ** * ** * a[size];
* * * ** **** ** ** ** * * i;
   
   
* * *** * * * * * * *** **** * *****
* ** ** ** * ** * ** *** * **** * ** * * ***** * * *** ** ** *** ** *** * ** ******* ** * *** ** ** ***** ** * * ** * * ** * ** *** * *** * **** * * * **
* ** **** * * * *** * * ** * ** * ** ** * * * * * ** ** ***** * ** ** * *** ** * ** * * * **** ** ****** *** ** * *** ** **** *** * **** * *
*** ** * * **** ** * * **** sum);
* * * * ** * ****
    **** *****
* * ****** ** * * ** ** 0;
}
answered by (221 points)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {

* * ** ** *** ** *** size;
* *** * ****** * ** *** sum;
* * * ******* **** *** * ** ** * ***** &size);
* ***** * ** **** *****
*** * * *****
* ****** * ***** * ** * * a[size];
* * ** * * i;
   
   
* ** * ********* ** ** **** * * ** *** * * * *
** * *** ** * * * * *** * *** *** ** ** * * ***** * ** *** *** * ** * * * * *** * * ** * * *** * * * ** ***** **** * *** * ** *** **** ***** * *** ******* ** *
* ******* * * ** *** * *** ******* ** ****** * ** * ** * * * *** * * *** ** ** * * *** * * ** * ****** *** *** * ** ***** * * * * *
*** * * **** ** ** * * * ** ** sum);
** * * ** * ***
    * * *
* * * * ** ** * 0;
}
answered by (221 points)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include ** * ** **
#include ** ** ** *

int main(){
* * *** * * input=0,n=0;
* **** ***** Number=0,Sum=0;
  
*** ** ** ** *** ** ** * &input);
* * **** **** * n<input; n++)
*** **
** ** * * *** * ** ***** ** **** * * * * ** * * * **** * * ** * * *** * *** ****
** *** *** * * * * * * ** * ** * ** ** * * ***** *
* * **
* ** ****** ** * * * ***
*** ** * ** * ** * ** ** ** *
******* * ** *** * 0;
}
100/100 answered by (183 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * * * ******
#include ******* ***

int main(int argc, char *argv[])
{
**** * * * **** *** * * *
* *** * ** * * * ** * * size;
*** * *** * * * * ** ** ***** *** ** &size);
* * * ** ** ** *** x[size];

* * * **
** * * * ** *
 
*** * **** sum = 0;
* * * *** **** * ** (int i=0; i <size; i++){
* * ** ** ** *** * ***** *** * **** * ** * * **** * * ******
* ***** ***** * *** **** * * * * * *** ** * * * * += x[i];
* ********* *** **** * * *
} ***** **
* * * **** * sum);
* * * ** * * * *** ** * ** ** ***  
** * * *** * * ** *** ** *** 0;
}
* * *** * * *
100/100 answered by (252 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(){
* ** *** ** ** *** * ** input=0,n=0;
* ** * * ** * ** * *** * Number=0,Sum=0;
  
* * * * * *** ** * * *** *** ** * **** ** * **
* * *** ** * * *** ** * * n<input; n++)
*** *** ** * * * *** * *
** * * * **** ****** **** * * ** ** ** * ***** ** * *** *** **** ** ** * **** ***** * ** * * &Number);
** ** * * ***** ** *** * **** * * * ** **** ** ** ** ** * * * ******* ****
* *** * *** * *** * *
*** * ***** ** *** * * * ** * ****
* * * * * * * * * ** ** * ***** *
** * ** * *** * * ***** 0;
}
100/100 answered by (192 points)
0 0
prog.c: In function 'main':
prog.c:9:11: error: 'o' undeclared (first use in this function)
     for(n=o; n<input; n++)
           ^
prog.c:9:11: note: each undeclared identifier is reported only once for each function it appears in
0 0
prog.c: In function 'main':
prog.c:9:11: error: 'o' undeclared (first use in this function)
     for(n=o; n<input; n++)
           ^
prog.c:9:11: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(){
** ** **** ****** * input=0,n=0;
* * ** **** * * ***** *** ** Number=0,Sum=0;
    
******* *** * * * ** * *** * ,&input);
***** ** * ** *** * ******* n<input; n++)
* ** ** * **** **
*** ** ***** * * *** ** ** * ***** *** *** * * *** * * * ** ** * * **** *** , &Number);
** *** ** * * ***** * * * ** * * **** * ** * * * * ** * ** * * * **
**** * * *** *** ** ******* ** * **** * ** *
** ** * ****** * *
** ** ** ** * * * * **** * *** * **** * * ,Sum);
** ** * *** ** * *** **** *** **** *
* * * ** * ***** * * 0;
} * *** ********** ** ** * * *** *** ***
** * **** ** * ** ** * * * * * * * * ** **** * * ** ** ** ** * * ** * * * * *
100/100 answered by (246 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(){
* *** * * * * input=0,n=0
* ** ** * *** * * Number=0,Sum=0
    
* ** * * **** * * ** * ***** * ,&input);
** * ** * *** ** n<input; n++)
* *** *** ** **** ** * *
* ** ** **** * * ** **** * ** **** *** * ********* ** * * ** * * ** * ******* * * *** * *** * , &Number);
** * ** * * * * ** * ** * * ** * ** *** * ** * ** * ** * * * ** *
*** ******* ****** * * *** * * **** ** * * * * * * * * ***
* * * * ** * *** ****
* ** **** ** * * ** ** ***** ** ***** *** * ,Sum);
* ** * *** * **** ** * ** ** ** ******** *
*** *** ** ***** ** ** 0;
} *** * * * ** ** * ** * ** * * **
* *** *** * * * * *** * * *** ** * * * * * ** ** ** *** * * ** * *** * * * ** * ******* **
answered by (246 points)
0 0
prog.c: In function 'main':
prog.c:6:5: error: expected ',' or ';' before 'int'
     int Number=0,Sum=0
     ^~~
prog.c:11:28: error: 'Number' undeclared (first use in this function)
              scanf("%d" , &Number);
                            ^~~~~~
prog.c:11:28: note: each undeclared identifier is reported only once for each function it appears in
prog.c:12:14: error: 'Sum' undeclared (first use in this function)
              Sum=Sum+Number;
              ^~~
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(){
*** **** ** * ***** * * a,b;
* ** ***** ****** x[5];
* * ****** ** *** *
* * * ** *** ** * * ** **** ** *** * * ******** *
    
* * * ** * * * ***** *** i=0;i<a;i++){
**** ** * ***** *** * * * ** ** **** * * *** ** * *** ** ** ** * * ** ** *
* * ** **** *** * * ** ** *** *** **** * * *** * *** * * ** * *
** * * ** ** *** *
* ** ** * *** *** * ** * ** * ** * * *
* * * * ** ** * *** * * ** 0;
}
100/100 answered by (283 points)
0 0
prog.c: In function 'main':
prog.c:8:19: error: expected expression before ')' token
     scanf("%d",&a,);
                   ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * ** * * ***
#include **** ** * *

int main(){
***** * ** * * * a, b;
* * * * * * * ***** * x[100];
** ** *
*** * * * * * ** * **
* * **** i=0; i<a; i++){
* ** * ** * * *** ** *** * ** &x[i]);
* ** * * *********** **
* * ** ** **
* * ** * b);
* * * * **** ** * ** * *** ***
* * ** * * 0;
}
100/100 answered by (220 points)
0 0
prog.c: In function 'main':
prog.c:8:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
  scanf("%d",a);
          ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.216.239
©2016-2025

Related questions

0 like 0 dislike
22 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41975 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 7.6k views
0 like 0 dislike
30 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41942 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 8k views
0 like 0 dislike
26 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41937 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 4k views
0 like 0 dislike
21 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41935 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 3.2k views
0 like 0 dislike
23 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41926 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 3.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users