Develop
2003.04.23 09:45
[c] 소수점 반올림^^
조회 수 8480 댓글 0
# 소수점 반올림 간단 예제
#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(); }
-
[c++] 기초강좌 #02(레퍼런스,메모리할당)
-
[c++] 기초강좌 #01(입출력,영역지정)
-
[c++] mfc 조건별 파일 검색 프로그램 소스 ㅋㅋ
-
[switch] 시스코 카탈리스트(Cisco Catalyst) 2950 미러링 설정
-
페이팔에서 돈 찾기 (Paypal withdraw)
-
[linux] GD 라이브러리 설치 방법..
-
[linux] vi 편집기 간단한 명령과 환경설정
-
[js] 인터넷 주소(URL) 인코딩 ㅋㅋ
-
[spring] 스프링 IoC/DI
-
[linux] iptables 명령어 매뉴얼(options)
-
[js] 한글주소(URL) 인코딩(encode, Encoding), 자바스크립트(JavaScript)
-
[c++] mfc에서 윈도우 항상 위 속성 주기..