문제풀이(Problem Solving)

C언어 예제 1 "Hello World!" [HackerRank]

게임이 더 좋아 2020. 3. 14. 21:35
반응형
728x170

C언어 예제 연습 ㄱㄱ 해석해주겠다. 물론 요약 ㅎ

 

 

Objective

 

In this challenge, we will learn some basic concepts of C that will get you started with the language. You will need to use the same syntax to read input and write output in many C challenges.

 

입력 출력을 배우겠다. 

 

 

Task

 

This challenge requires you to print Hello, World! on a single line, and then print the already provided input string to stdout.

Note: You do not need to read any input in this challenge.

 

Hello world!를 출력하고 이미 입력된 것을 출력하자.

그니까 우리가 입력을 할 필요가 없다는 것이다.

 

Sample Input 0

 

Welcome to C programming.

 

Sample Output 0

 

Hello, World!

Welcome to C programming.

 

 

이렇게 나와야한다.

 

그니까 Welcome to C programming 만 넣었는데? output이 2줄 나온 것이다.

 

 

이렇게 하면 나오긴 한다. 

 

1.

scanf는 밖에서 입력을 받는 것이다. 입력을 받을 필요는 없다고 했으니

 

s라는 0-99짜리 문자열을 만들고 거기다 입력 받은 것을 s에 저장한다.

 

(입력은 이미 주어져잇다고 문제에 나왔다)

 

2.

Hello World부터 나와야 하니까  먼저 출력을 해준다.

 

3. 

그 다음 s를 출력하면 입력받은 것을 출력할 수 있다.

 

 

728x90
반응형
그리드형