본문 바로가기
프로그래머스코딩테스트연습풀이/C언어

[프로그래머스/C언어] 정수 부분

by 코코쵸마 2023. 8. 2.

문제

실수 flo가 매개 변수로 주어질 때, flo의 정수 부분을 return하도록 solution 함수를 완성해주세요.

 

솔루션

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

int solution(double flo) {
    int answer = 0;
    answer = flo / 1;
    return answer;
}

https://school.programmers.co.kr/learn/courses/30/lessons/181850