Double
-
Imprecision, overflow | CS50 Week 1Computer Science/CS 50 Harvard 2021. 11. 7. 01:55
floats를 나누고 그 값을 프린트하는 프로그램을 작성해보자. #include #include int main(void) { // Prompt user for x float x = get_float("x: "); // Prompt user for y float y = get_float("y: "); // Divide x by y float z = x / y; printf("%f\n", z); } 2개의 floats를 받아서 나눈 후 printf에서 %f를 이용해 프린트하는 로직이다. 컴파일 후 실행시켜보자. > make calculator_div clang calculator_div.c -lcs50 -o calculator_div > ./calculator_div x: 2 y: 3 0.666667 > ..