# 소수점 반올림 간단 예제
#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(); }