1 / 6

C programming

C programming. Week 5. C coding. Create the code for the following programs and check the results of the program. Ex #1 (while and for). 다음 화면과 같은 구구단을 while 과 for 를 이용하여 각각의 방법으로 코딩해 보자. Output’s example. Ex #2 (Function #1). 헤더 파일인 <math.h> 를 선언하면 별도의 함수 선언 없이 절대값 , log, 제곱근 등의

casey-guy
Download Presentation

C programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C programming Week 5

  2. C coding Create the code for the following programs and check the results of the program.

  3. Ex #1 (while and for) 다음 화면과 같은 구구단을 while과 for를 이용하여 각각의 방법으로 코딩해 보자. Output’s example

  4. Ex #2 (Function #1) 헤더 파일인 <math.h>를 선언하면 별도의 함수 선언 없이 절대값, log, 제곱근 등의 함수를 사용할 수 있다. 하지만 이번 실습에서는 <math.h> 의 선언 없이 fabs함수(즉, float형 자료의 절대값 계산)와 pow함수( 즉, 을 계산)를 구현해보자. fabs함수 구현의 예시 pow함수 구현의 예시

  5. Ex #3 (Function #2) • 문자반복 출력하는 함수를 만들어 보자. 예를 들어 char_print() 함수를 작성해 보자. • void char_print(char, int, int)를 만들어 • 첫 번째 인자에는 char형으로 화면에 반복 출력할 문자를 • 두 번째 인자에는 int형으로 첫 번째 인자인 문자를 하나의 가로 행에 반복 출력할 횟수, 다시 말해세로열의 개수를 입력 받고, • - 세 번째 인자에는 int형으로 출력될 라인 수, 즉 가로 행의 개수를 입력 받는다. 실행의 예

  6. Ex #4 (Recursive function) Recursive function(재귀함수)란함수 내에서 자기 자신을 호출하는 함수를 말한다. 이러한 성질을 이용하여 factorial을 구하는 함수를 만들어 보자. 1! = 1 2! = 1*2 = 2 3! = 2!*3 = 1*2*3 = 6 4! = 3!*4 = 2!*3*4 = 24 … … …

More Related