c언어 절대값 구하기 abs()

in #kr-dev6 years ago

안녕하세요!! @wonnieyoon 입니다.
코딩을 하다보면 생각보다 절대값을 사용해야 하는 경우가 많습니다.
특히, 저의 경우 절대값을 주로 HTS 개발중 현재가를 가져와서
데이터를 가공할때 사용합니다.
현재가 : -9999, +5000 이런식으로 오는데 -,+ 붙는 이유는 부호를 나타내기 위해서 내려옵니다.
현재가에 대해 이해가 안된다면 주식을 한번 해보는것을 추천!!

※ abs()
:절대값을 만들어주는 함수

※사용법
#include "stdafx.h"
#include <math.h>

int _tmain(int argc, _TCHAR* argv[])
{
int a = -3;
printf("%d\n", abs(a));

}

※결과
3

Sort:  

(jjangjjangman 태그 사용시 댓글을 남깁니다.)
[제 0회 짱짱맨배 42일장]4주차 보상글추천, 1,2,3주차 보상지급을 발표합니다.(계속 리스팅 할 예정)
https://steemit.com/kr/@virus707/0-42-4-1-2-3

4주차에 도전하세요

그리고 즐거운 스티밋하세요!

Congratulations @wonnieyoon! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @wonnieyoon! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 64498.18
ETH 3079.08
USDT 1.00
SBD 3.86