0 thích 0 k thích
7k đã xem

Please write a program, including function(s), that receives one input number, then shows the squared value of the input.

Input 1

10

Output 1

10
100

Input 2

12

Output 2

12
144

[Exercise] Coding (C) - đã hỏi trong Chapter 3: Branching, Looping and Functions bởi (5.9k điểm)
ID: 39810 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 7k đã xem

16 Trả lời

0 thích 0 k thích
Hidden content!
#include * * * * *
#include ** **** ***

int * **** ***
void ***** *** * number);

int main(int argc, char *argv[])
{
** ** *
*** ******** * * * a;
* ** ** * * = * *
* ** * *** **
* * **** **
** ** ***** * ** *
** * * ** ** ** ** ** * ***
* * *** * *** * 0;
}

void ** * * * * number){
* ********** * **** ** * * * * * *** * *** * ** **
*** * ** ****** ** * *** * * *
}

int ***** ***
*** ** * ***** * * ***** x;
* * ** * *** * ** * *** **** * * &x);
* * * ** ** * **** ** * * x; ******* * * * *
}
100/100 trả lời
đã sửa bởi
0 0
/tmp/ccBixDvw.o: In function `main':
prog.c:(.text+0x15): undefined reference to `readNumber'
collect2: error: ld returned 1 exit status
0 0
/tmp/ccU0sfkC.o: In function `main':
prog.c:(.text+0x15): undefined reference to `readNumber'
collect2: error: ld returned 1 exit status
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include **** ** ** *
#include *** ** ** ** *

int ** **
void *** * number);

int main(int argc, char *argv[])
{
* * * *******
* ** ** ** * ** a;
** * * * = * *** *
* **
*** * * *
** * * ***** * **** ***
***** *** * **** * *****
***** *** * ****** 0;
}

void ** * number){
** ** *** * **** * ** * * *** *** ** * *****
** ** * * ** *** ** * ** *
}

int * * *
*** ** *** * ** ** * * * x;
* ** ****** ** * * ** * * ***** ** ** * **** &x);
**** ** * * ** *** * ** * x; * * ** * ** *
}
100/100 trả lời bởi (183 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
* * * * ***** *
** * *** *** * **

int main(){
** **** * ** int s,n;
* * * * *
* * * *** *** *** * * * * *
*** * *** *** * *
* ***   n=s*s;
* * *
* ** * *** * ****** **
}
100/100 trả lời bởi (244 điểm)
đã sửa bởi
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
* * * * *** * * * **
* * ** * ***** *** *

int ***
void * ** * ** number);

int main(int argc, char ****
{
** * * * * ** *
* ** * x;
** * * = * *
* * **
* *** *** ***

*** * *** *** * *** 0;
}

void * ** ** * *
** * ** * * * ** **** *
** ** ** * ** * * ** *** * **
}

int * *******
* ****  int y;
*** * *** *** * *** *** ** ** **
* ** *** * y;    
}
80/100 trả lời bởi (269 điểm)
0 0
prog.c: In function 'main':
prog.c:10:2: error: stray '\302' in program
  \xc2\xa0int x;
  ^
prog.c:10:3: error: stray '\240' in program
  \xc2\xa0int x;
   ^
prog.c:11:2: error: stray '\302' in program
  \xc2\xa0x = readNumber();
  ^
prog.c:11:3: error: stray '\240' in program
  \xc2\xa0x = readNumber();
   ^
prog.c:13:2: error: stray '\302' in program
  \xc2\xa0writeNumber(x*x);
  ^
prog.c:13:3: error: stray '\240' in program
  \xc2\xa0writeNumber(x*x);
   ^
prog.c: In function 'readNumber':
prog.c:24:2: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0int y;
  ^
prog.c:24:3: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0int y;
   ^
prog.c:24:5: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0int y;
     ^
prog.c:24:6: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0int y;
      ^
prog.c:25:2: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0scanf("%d", &y);
  ^
prog.c:25:3: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0scanf("%d", &y);
   ^
prog.c:25:5: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0scanf("%d", &y);
     ^
prog.c:25:6: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0scanf("%d", &y);
      ^
prog.c:26:2: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
  ^
prog.c:26:3: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
   ^
prog.c:26:5: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
     ^
prog.c:26:6: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
      ^
prog.c:26:17: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
                 ^
prog.c:26:18: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
                  ^
prog.c:26:20: error: stray '\302' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
                    ^
prog.c:26:21: error: stray '\240' in program
  \xc2\xa0 \xc2\xa0return y; \xc2\xa0 \xc2\xa0
                     ^
0 thích 0 k thích
Hidden content!
#include *** * * * *
#include **** ***

int * * * ****
void * ** * number);

int main(int argc, char *argv[])
{
* **
* ** **** * a;
*** * = ** * *
*** *** **
** * * ** **
***** ** * * ***** * *
* * * *** **** * * * * * * * * ***
* *** ** * 0;
}

void ****** number){
** *** *** *** ** * * * * * * * *** * * * * ***** **
** **** *** * ** * *** *
}

int * *
** *** ** ***** * ** ** x;
*** ** ** **** ** *** * ** **** * *** * &x);
*** ***** * * ** * * x; * * * * *
}
100/100 trả lời bởi (192 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include * *** ** ****
** *** * * ****** * ***

int ******
void * * ** number);

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

* * * ** *** *** 0;
}

void number){
***** ** *** *** ** *** * * * * ******* ** ***
** ** * ** * * *** ******* ***
}

int *******
**** ** *** * * ***** x;
* *** * ******* * ******* ** * * * ** ** *
* * *** ** * *** ** * * * x; ****** *** ***** ***
}
100/100 trả lời bởi (281 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include * ** * * **
#include * *** * * ** **

int * ** ** *
void ***** ** number);

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

* * ** 0;
}

void * ** ** ** number){
* * ** ** ***** *** *** * *** * **** ** * * * * * *
* * ** ***** * * * * **
}

int *****
* **** **** * ** ** x;
** *** *** ** *** ** * * **** * * * * *** * *
* ** ** ***** **** x; ** * * * ***
}
100/100 trả lời bởi (269 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include **** * * * *
#include **** * * * *

int * * **
void ** * *** number);

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

**** * ** * * * 0;
}

void ** * number){
* ******** ***** * ** ** * *** * * *******
* * * ***** ** * * * *** *
}

int * *
**** ** ** * * ** * ***** * * x;
* * ** *** * * ** *** ** * ****
*** ** * *** * ** ******* x; *** ** ** * * * ***
}
100/100 trả lời bởi (221 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include *** *** ** * * * *
#include ** *** * * ***

int * **
void * ******** number);

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

* * * * * 0;
}

void ** * *** number){
** * * ****** * *** * * * * *** * ** * * *
** * * ** ** **** ** * * ** *
}

int * ****
*** * * ** * ** * * x;
** * * * * *** * * *** * * * * ** ***
* *** * * * * * * *** * x; ** ** **
}
100/100 trả lời bởi (273 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 thích 0 k thích
Hidden content!
#include *** *** ** *
#include * ** ***** *

int * *
void * * * number);

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

* ** *** * * 0;
}

void *** *** number){
*** * ** * * ** ******** *** * *** *** *
* * **** ** ** * * * *
}

int *
* * * * * * * *** **** * x;
** *** ** * * ** *** * *** ** ** * ** *
** * **** * ** * * *** x; **** *** * * **
}
100/100 trả lời bởi (290 điểm)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
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:104.23.243.108
©2016-2026

Những câu hỏi liên quan

0 thích 0 k thích
22 trả lời
[Exercise] Coding (C) - đã hỏi ngày 30 tháng 12 năm 2017 trong Chapter 3: Branching, Looping and Functions bởi nat236919 (5.9k điểm)
ID: 40236 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 9.6k đã xem
0 thích 0 k thích
18 trả lời
[Exercise] Fill in the blank - đã hỏi ngày 23 tháng 12 năm 2017 trong Chapter 3: Branching, Looping and Functions bởi nat236919 (5.9k điểm)
ID: 39813 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 3.9k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên