0 like 0 dislike
5.8k views

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) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 39810 - Available when: Unlimited - Due to: Unlimited
| 5.8k views

16 Answers

0 like 0 dislike
Hidden content!
#include ** * **** **
#include ** * ** *

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

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

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

int ** ** * *
** ** *** ** ** * x;
* ** **** * * *** ***** * &x);
* ********** ***** * * * x; * ** * ** * *
}
100/100 answered
edited by
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 like 0 dislike
Hidden content!
#include * ***** ***
#include * * * * * ** *

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

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

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

int *** *
*** ***** **** * * ** x;
*** ** ** * * * * ** * *** ** *** * * &x);
** * ** *** ** ****** * *** * x; * *** ** ** ***
}
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!
* *** ** ** ** ***
**** * ** * ** *

int main(){
** int s,n;
*** * ** *
* ** ** * * * * **** * *** *
** * * *
**   n=s*s;
* * * ***
* * ** * * ** ***** *
}
100/100 answered by (244 points)
edited by
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 like 0 dislike
Hidden content!
** * ** * * **
* *** **** **

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

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

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

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

int * *** *
* **  int y;
* *** ** * *** * ***** **** * * *
** ** * *** y;    
}
80/100 answered by (269 points)
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 like 0 dislike
Hidden content!
#include ** * ** * *
#include * **** * *****

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

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

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

int *** ** *
**** **** ******* **** ** x;
* ** * ***** * * ** ** * **** &x);
* * **** * * * ** *** ** x; **** *** ** **
}
100/100 answered by (192 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 * * * *** *
* * ***

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

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

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

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

int ** *** **
***** * ** *** *** * * ** x;
**** **** ** ** **** *** ** ** * **** *
** * ** ** *** *** ** x; ** ** *** ** ******
}
100/100 answered by (281 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 * * * *
void * * * number);

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

** * ** * ** 0;
}

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

int * * ** *
*** ** * * *** * * ** ** x;
** * * ** * * * * * * ** * * * ****
***** * * **** ***** * * x; *** ** * *** * **
}
100/100 answered by (269 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 * *
void * * * *** * * number);

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

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

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

int * ***
** * *** * * * * *** x;
* ***** ******* * * ** *** * * ** ** * **
** ** ***** * * **** x; * *** ** ** * * *
}
100/100 answered by (221 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 ** *** *
void ** ** number);

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

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

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

int ******
* *** ***** ** *** * ** x;
** * ** * *** ** *** ** * **
** ** ** ** * * *** * * ** ** ** x; ** * * * ** **** **
}
100/100 answered by (273 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 *
void * * *** number);

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

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

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

int * * *
* * *** ** * ********* ** x;
** *** * * ** * ** * ** ** * *
* ** *** **** **** ** *** x; **** *** ***
}
* **
100/100 answered by (290 points)
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.197.94
©2016-2026

Related questions

0 like 0 dislike
22 answers
[Exercise] Coding (C) - asked Dec 30, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 40236 - Available when: Unlimited - Due to: Unlimited
| 8.1k views
0 like 0 dislike
18 answers
[Exercise] Fill in the blank - asked Dec 23, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 39813 - Available when: Unlimited - Due to: Unlimited
| 3.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users