0 like 0 dislike
4.3k 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
| 4.3k views

22 Answers

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

int rec(){

** ** ** * ** **** a;
* ** * * * ** * ****** ** **** * * * ** ** *
* * * * * * * ** ** a;
}
int main(int argc, ** *
{
* * *** * *** * * *** * a = rec();
** **** *** * * ** * * ** *
* **** ** * ** ** * * * ***
}
else{
* * ** * a);
}
* * *** * * ** ** 0;
}
* *** *
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 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int rec(){
* * * ** * ***** a;
** ** **** * * ***** *** ** * ** &a);
**** * ** ** * * *** * ** a;
** * *** ***** ***

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

* ******* ** * *** *** ** * *** *** ********* *
** *** * ** 0;
}
100/100 answered by (271 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[])
{
** ** * *
* * * **** input;
** * * * **** * * * ** *** *** * ** *
** **** *** * * == 2018){
** *** ** * ** * * ** ** ***** * *** ** ** * * * ****** * * * ** * ** * *** * *** ** * *** ** **
}
else{
* * * *** * ** *** * * * * * * *** *** ** input);
}
** * *
* * *** ** ** ****  
* * ** * *** * * 0;
}
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 readNumber();

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

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


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

/* run this program using the console pauser or add your own getch, ** * ***** * ** * or input loop */

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

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

int ** ****
** * ** ** ** ** **** x;
* * * ** * *** **** ** * *** * * * ** ***
** *** * * * *** * * * * (x == 2018)
* * * **** * * ** ** **** ** * ***** * ** * *** * ** * ** *
** *** **** * **
** ** * ** * x;
}
100/100 answered by (252 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Nice one. But..

\n is not necessary
0 like 0 dislike
Hidden content!
#include * **** **
#include * ****** *** *

int readNumber();

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

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


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

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

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


int ** * **
* *** * *** ** *** ** x;
* ** * *** **** * ** * * ** ***** * ** &x);
** * * *** * * * *** ** * x; * ** * * * * * *
}
100/100 answered by (153 points)
0 0
Case 0: Wrong 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!
#include <stdio.h>
#include <stdlib.h>

int fiona(){
****** * ** * * * * ** a;
*** ****** *** * ****** * * * * ** &a);
* * *** ** ** * * ** * * a;
*** * ********** * * **

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

* * * *** * * * * *** * *** * ****** ** * *
** * ** ** ** 0;
}
100/100 answered by (269 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Happy New Year 2018 !! is not correct. Please use underscores + no space for exclamation mark.

Don't forget to use at least one function. And for other numbers besides '2018', it will only show the numbers themselves.
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
*** ****** *****
** ***** * **

/* run this ** using the pauser or add your own getch, * ** * ** *** * or input loop */

int ** *** argc, char {
int a;
* ***** ** ** * * ***** enter a * ****
** ** * ** * *** * * ** * * *
* * * * * * * ****
* *** * *** * *** ** ** *** * * ** * * ** **** *** *
** ** * * }
****** * * * * * *** *******
* * * *** * * **** ** ** **** * * ** * * *
* * ** * **** * ** * **
*** ** * ** * * ** * * *
* *** * * * return 0;
* *** **

* *
answered by (227 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
This part printf("please enter a year"); is unnecessary.

And please use at least one function :)
0 like 0 dislike
Hidden content!
* ** * *** * ** *****
* ** ** ** * * ** *

/* run this using the * * * * or add your own getch, ***** ** **** **** or input loop */

int * ** * argc, char ** * {
int a;
*** ** * *** * * * * * ** **** enter a ** ** **
* * * * * * ** * * *
* * * * ** * *** *
* ** * * * * * * * *** ***** *** happy new * **** * ****
* * *** ** ** * }
** ** *** ** *** * *
* * ** * * ** ** * * * ***** *** * ****** * * *
** * * * *** *** ** ****
* * ** *** ** * *** * ***
** * *** * * 0;
*** * *** **

* * *
answered by (227 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.255.47
©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
| 1.9k 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
| 3.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users