Contents

Develop
2003.04.23 09:45

[c] 소수점 반올림^^

조회 수 8501 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

# 소수점 반올림 간단 예제

#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. [c] 서비스 거부 공격(DoS;Denial of Service) 간단 소스.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views6739
    Read More
  2. [c] 셀프 넘버(Self Number) 구하기

    Date2016.09.09 CategoryDevelop Byhooni Views2392
    Read More
  3. [c] 소수 구하기 #1 (한정된 숫자 내에 있는 소수 걸러내기)

    Date2003.04.23 CategoryDevelop Byhooni Views7881
    Read More
  4. [c] 소수 구하기 #2 (입력한 숫자가 소수인지 판별하기..)

    Date2013.04.23 CategoryDevelop Byhooni Views11010
    Read More
  5. [c] 소수점 반올림^^

    Date2003.04.23 CategoryDevelop Byhooni Views8501
    Read More
  6. [c] 소켓 스트림 서버/클라이언트 (UDP)

    Date2013.04.23 CategoryDevelop Byhooni Views7615
    Read More
  7. [c] 소켓 프로그래밍 요약..

    Date2003.04.23 CategoryDevelop Byhooni Views6995
    Read More
  8. [c] 소켓의 세가지 동작모드

    Date2003.04.23 CategoryDevelop Byhooni Views6943
    Read More
  9. [c] 소켓주소 구조체에 대해..

    Date2003.04.23 CategoryDevelop Byhooni Views6762
    Read More
  10. [c] 숫자 맞추는 게임..

    Date2013.04.23 CategoryDevelop Byhooni Views6953
    Read More
  11. [c] 숫자(int, Number)를 hex코드로 변환하는 소스

    Date2013.04.23 CategoryDevelop Byhooni Views8138
    Read More
  12. [c] 스택/힙 오버플로우 테스트(overflow)

    Date2003.04.23 CategoryDevelop Byhooni Views7391
    Read More
Board Pagination Prev 1 ... 20 21 22 23 24 25 26 27 28 29 ... 71 Next
/ 71