Develop
2003.04.23 09:45

[c] 소수점 반올림^^

Views 8478 Votes 0 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] whois정보 조회 프로그램

  2. [c] 최대공약수 알고리즘 (유클릿)

  3. [c] 소수점 반올림^^

  4. [c] 하노이탑 - 재귀함수

  5. [c] 팩토리얼.. - 재귀함수

  6. [c] 간단한 채팅(클라이언트/서버) 프로그램 소스

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

  8. [opengl] 컴퓨터 그래픽스 강의 자료(수업자료)

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

  10. [c++] p.58 연습문제 2번

  11. [c++] p.118 확인학습 5번

  12. [c] 프로그래밍 ppt, 스킬업 (비트 수업자료)

  13. [css] 스크롤바 안생기게

  14. [c] 민수형 libipq 샘플 소스 ㅋㅋ

  15. [php] 니우쪽지다.. 받아라~ ^^

  16. [c++]현승이가 보내준 동영상 암호화 자료.. 볼것..

Board Pagination Prev 1 2 3 4 5 ... 53 Next
/ 53