본문 바로가기

Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
더보기
Archives
Total
Today
Yesterday
관리 메뉴

인공지능을 알아가보자

함수를 이용한 x*x+1구하기! 본문

Emotion

함수를 이용한 x*x+1구하기!

lis29188 2018. 4. 5. 23:13

제시한 식은 다른 명령어로도 쓸수있지만 함수로만 표현할수있는 식은 재귀함수이기에 읔 이식으로 하겠습니다...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
int f(int x);
int main()
{
    int n , result;
    int a, result1;
    printf("정수를 입력하세요:");
    scanf("%d"&n);
    result = f(n);
    printf("%d\n", result);
}
int f(int x)
{
    return x*+ 1;
     
}
cs


'Emotion' 카테고리의 다른 글

함수를 이용한 사칙연산 계산기  (0) 2018.05.02
포인터와 이중포인터!  (0) 2018.04.11
별찍기(6)  (0) 2018.04.02
별찍기(5)  (0) 2018.04.02
별찍기(4)  (0) 2018.04.02
Comments