Contents

Develop
2003.04.23 09:45

[c] 소수점 반올림^^

Views 8503 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
433 Develop [ios] iOS 8 개발자가 우선 알아야 할 3가지 file hooni 2014.10.02 992
432 Develop [ios] iOS 7 이상 UIBarButtonItem 여백 file hooni 2014.03.27 4105
431 Develop [ios] iOS 6.0 이상 회전 하기 (이전 버전과 비교 변경 부분) file hooni 2014.01.27 34244
430 Develop [ios] iOS 4.0 beta 에서 3.1.3으로 다운그레이드 하는 법 file hooni 2013.04.23 37544
429 Develop [ios] In App Purchase 개발 hooni 2013.11.20 9303
428 Develop [ios] iCloud관련 저장 디렉토리 hooni 2013.04.23 29677
427 Develop [ios] IB 없이 개발하기 (html) secret hooni 2013.05.31 0
426 Develop [ios] Hybrid 앱 스터디 발표 자료 file hooni 2013.09.06 13820
425 Develop [ios] How To Use UIScrollView to Scroll and Zoom Content (Using Swift) file hooni 2016.03.23 7715
424 Develop [ios] How To Use UIScrollView to Scroll and Zoom Content (Using Objective-C) file hooni 2016.03.23 1773
423 Develop [ios] How to set up clang formatter hooni 2015.09.17 1478
422 Develop [ios] GPS 이용 상태 확인 hooni 2015.04.27 1422
Board Pagination Prev 1 ... 30 31 32 33 34 35 36 37 38 39 ... 71 Next
/ 71