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
829 Develop 링크들 보고 지울 내용 secret hooni 2019.11.21 0
828 Develop [js] 2048 예쁘게 만들고 있는거.. ㅋㄷ secret hooni 2015.01.30 0
827 Develop [js] 주소표시줄 URL 읽어오기 (변경까지) secret hooni 2014.01.21 1
826 Develop [php] XE 스킨에서 특정 도메인 리다이렉션 file hooni 2015.01.28 583
825 Develop [ios] 새로 만들고 있는 DateMemo file hooni 2016.07.12 608
824 Develop [php] XE에서 도메인 별로 광고 다르게 적용하기 file hooni 2015.01.28 620
823 Develop [ios] 앱의 로컬 js 파일에서 해당 프로젝트의 이미지 불러오기 hooni 2015.02.10 631
822 Develop [ppt] iOS 플라랩#04(2015.06.19) 발표 자료 file hooni 2015.06.04 638
821 Develop [ios] NSData to NSString (NSString to NSData) hooni 2015.07.21 640
820 Develop [sh] html 안에 있는 img 다운 받는 쉘 스크립트 file hooni 2020.05.26 643
819 Develop [ios] VIN Scanner (VIN barcode) 스캐너 file hooni 2017.09.16 650
818 Develop [ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ hooni 2015.06.26 657
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71