0 like 0 dislike
5.7k views

Please write a program using at least one function to receive a number '2018', then outputs Happy_New_Year_2018!!  For other numbers received it will show those numbers instead.

Input 1 

2018

Output 1

2018
Happy_New_Year_2018!!

 

Input 2

69

Output  2

69
69

[Exercise] Coding (C) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 40236 - Available when: Unlimited - Due to: Unlimited
| 5.7k views

22 Answers

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

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

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

void **** number){
* ** * * int a;
* * * if (a == 2018){
* * * ** *** * * printf * * ** ** ** *** * * ****
** * *** } else
* *** * * * *** **** * *** * * **** * * * * ** **
**** * *** * ** ** * * * ** *
}

int ** *
* * * * ** * *** * ** x;
***** * ** * * * ** * *** ** * *
*** * * *** * * * * *** * x; **** * **
}
100/100 answered by (268 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
I could've only used if... but I don't know if 'if' a function or not
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Your code is correct. Using only If...else statement is more like a condition not function.
0 like 0 dislike
Hidden content!
** *** * * *** *
** ***** ***

/* run this ** * the * * or add your own * * ** *** ** * * ** or * * */

** ** * *
** * * * * * * * * * * * * **
}

int *** * * char ****** {

int num;
****** * * * *** * * * *

* *** ** * *** **
* * * ** ** ** * * * **
** * ** * * }
* * ** *
*** * ***** *** else
* * ** *** **** ****** **** * **
* ** * * * ** *
* * * *** * * 0;
}
answered
0 0
-----------Re-judge-----------
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:162.158.159.55
©2016-2025

Related questions

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
| 2.5k views
0 like 0 dislike
16 answers
[Exercise] Coding (C) - asked Dec 23, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 39810 - Available when: Unlimited - Due to: Unlimited
| 4.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users