프로그래머스코딩테스트연습풀이/C언어

[프로그래머스/C언어] 공배수

코코쵸마 2023. 7. 13. 23:13

문제

정수 number와 n, m이 주어집니다. number가 n의 배수이면서 m의 배수이면 1을 아니라면 0을 return하도록 solution 함수를 완성해주세요.

 

솔루션

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

int solution(int number, int n, int m) {
    int answer = 0;
    if(number % n == 0 && number % m == 0)
        answer = 1;
    return answer;
}

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

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr