Contents

Develop
2003.04.23 09:45

[c] 소수점 반올림^^

Views 8501 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 [Xcode] 디버깅 옵션 file hooni 2013.04.23 57262
24 Develop 레고 NXT 마인드스톰 밸런싱 로봇 ㅎㅎ file hooni 2013.04.23 57768
23 Develop [android] SurfaceView를 이용한 애니메이션 ㅎㅎ file hooni 2013.04.23 57776
22 Develop [vb] 비주얼 베이직 131페이지 hooni 2003.04.23 58164
21 Develop [vb] 비주얼 베이직 순위 정렬 루틴 hooni 2003.04.23 58440
20 Develop [c#] Json 라이브러리 (System.Net.Json.dll) file hooni 2013.04.23 58586
19 Develop [vb] 비주얼 베이직 141페이지 hooni 2003.04.23 59024
18 Develop [android] Canvas를 이용해 이미지 확대/축소 하기 hooni 2013.04.23 60797
17 Develop [sh] 쉘스크립트 if 비교 연산 hooni 2020.05.26 61000
16 Develop [vb] 비주얼 베이직 자격증용 ㅎㅎ hooni 2003.04.23 61585
15 Develop [c#] 간단한 IPC 통신 예제 hooni 2013.04.23 63777
14 Develop [Android] 2010년에 만들었던 세미나 자료. file hooni 2013.05.28 64743
Board Pagination Prev 1 ... 62 63 64 65 66 67 68 69 70 71 Next
/ 71