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
585 Develop [js] 쿠키(cookie)에 대한 설명과 예제.. hooni 2003.04.23 8351
584 Develop [js] selectbox 선택 후 input 박스에 적용 hooni 2013.04.23 8347
583 Develop [swift] NotificationCenter 간단 예제 file hooni 2021.01.27 8339
582 Develop [c] 이진트리(binary tree)의 운행.. hooni 2003.04.23 8309
581 Develop [c++] 레지스트리 편집하는 부분..ㅡㅡ; file hooni 2013.04.23 8304
580 Develop [c++] 현승이가 준 메신저 소스.. ㅋㅋ file hooni 2013.04.23 8299
579 Develop [c] 문자열 정렬 함수 qsort() hooni 2003.04.23 8274
578 Develop [c] selec()를 이용한 입출력 다중화 file hooni 2013.04.23 8272
577 Develop [unix] Java 애플릿용 HTML 자동 생성 hooni 2014.02.19 8268
576 Develop [php] 마시마로 캐릭터 방명록 file hooni 2003.04.23 8266
575 Develop [c] 그래픽 차트 라이브러리.. 나중에 확인 해볼 거.. file hooni 2013.04.23 8241
574 Develop [vb] 64bit RSA 프로그램 소스 ㅋㅋ file hooni 2013.04.23 8233
Board Pagination Prev 1 ... 45 46 47 48 49 50 51 52 53 54 ... 98 Next
/ 98