"C언어 abs()"의 두 판 사이의 차이

15번째 줄: 15번째 줄:


==예시==
==예시==
<source lang='console'>
<source lang='c'>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>

2018년 3월 8일 (목) 00:32 판

1 개요

C언어 abs()
C Language abs()
  • 절대값 구하기

2 문법

  • 헤더
stdlib.h
  • 정의
int abs (int n);

3 예시

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("%d\n", abs(13)); // 13
    printf("%d\n", abs(-14)); // 14

    return 0;
}

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}