Contents

Develop
2003.04.23 09:45

[c] 소수점 반올림^^

Views 8478 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

# 소수점 반올림 간단 예제

#include<stdio.h>
#include<conio.h>
#include<stdio.h>

int gcd(int m, int n) {
    if (m<=0) return 0;
    if (n<=0) return 0;

    while(m != n}){
        if (m>n) m = m - n;
        else n = n - m;
    }

    return n;
}

void main(){
    float num,tmp;

    printf("Enter a float Number : ");
    scanf("%f",&num);

    tmp=(num*10);
    tmp=(tmp-(int)tmp)/10;

    if(tmp>=0.05) num=num+(0.10-tmp);

    printf("%fn",num);
}

void main(){
    int a,b;

    printf("Enter a first Number : ");
    scanf("%d",&a);

    printf("Enter a second Number : ");
    scanf("%d",&b);

    printf("GCD is %d",gcd(a,b));
    getch();
} 


?

List of Articles
No. Category Subject Author Date Views
25 Develop [Android Error] The number of method references in a .dex file cannot exceed 64K hooni 2016.11.10 754
24 Develop [ajax] 이벤트 코드 생성기 작업중.. ㅋㅋ file hooni 2013.04.23 7116
23 Develop [ajax] 샘플 코드와 한글처리에 대한 간단한 설명 hooni 2013.04.23 6842
22 Develop ZBar 라이브러리를 이용한 바코드 스캔 앱 개발하기 file hooni 2015.01.01 1628
21 Develop XML, JSON, BSON, MSGPACK 장,단점 비교 file hooni 2017.01.11 2239
20 Develop XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그 file hooni 2016.04.21 864
19 Develop What is difference between Get, Post, Put and Delete? hooni 2018.02.28 1400
18 Develop URI 인코딩, URL 인코딩 file hooni 2013.04.23 18845
17 Develop SVN 초간단 사용하기 hooni 2014.02.28 7616
16 Develop SVN 명령어 (SVN command) hooni 2014.02.28 12137
15 Develop OPT와 CAS에 대한 자료.. (교수님 메일로 보내드린 자료..) file hooni 2013.04.23 13917
14 Develop OpenGL 강좌 사이트 모음 hooni 2013.04.23 9637
Board Pagination Prev 1 ... 62 63 64 65 66 67 68 69 70 71 Next
/ 71