Contents

Develop
2003.04.23 09:45

[c] 소수점 반올림^^

Views 8498 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();
} 


?

  1. [php] GregorianToJD(), JDToGregorian() 함수 내용

  2. [php] 날짜 정보 출력 (년,월,일,시,분,초)

  3. 최근 논문 자료 (2011/01/03, 만현형한테 보낸거..)

  4. [c] OpenGL 임시로 여기 올림..

  5. [c++] Window API(MFC) 오목 게임

  6. [java] 입출력 스트림 2부 (바이트)

  7. [c] pcap을 이용한 패킷 분석 ㅎㅎ

  8. [c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스

  9. [c] 최단거리 알고리즘 & 예제소스..

  10. [c] 간단한 자료구조(stack, queue, linked list) 구현 소스

  11. [c++] p.47 연습문제 3번

  12. [c] 분수계산 함수^^

Board Pagination Prev 1 ... 17 18 19 20 21 22 23 24 25 26 ... 71 Next
/ 71