5086 : Factors and Multiples

네르기·2021년 8월 11일
0

알고리즘

목록 보기
8/76

뭐하는 문제인가?

약수랑 배수 관계에 있는지 확인하는 문제.

너무 쉽다

그저 나머지 연산(%)만 쓰면 된다.

#include <stdio.h>

int main() {
    int a,b;
    while(1) {
        scanf("%d%d",&a,&b);
        if(!(a||b)) return 0;
        if(b%a==0) printf("factor\n");
        else if(a%b==0) printf("multiple\n");
        else printf("neither\n");
    }
}

더 이상의 설명이 필요한지?

profile
프로그래머와 애니메이터가 되고파

0개의 댓글