본문 바로가기
  • 밥 하루하루
공돌이/C언어

[백준/C언어] 배수와 약수 (5086번)

by BobBob 2024. 3. 21.
728x90
반응형

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h> // malloc, free 함수를 사용하기 위해 필요
#include <string.h>

int main(void) {
    int input1, input2;

    while (1) 
    {
        scanf("%d %d\n", &input1, &input2);
        if (input1 == 0 && input2 == 0)
            break;
        else if (input2 % input1 == 0)
            printf("factor\n");
        else if (input1 % input2 == 0) 
            printf("multiple\n");
        else  
            printf("neither\n");
  
    }

    return 0;
}

 

 

-. swtich문으로 하려다가 if, else if, else로 했습니다. 

 

728x90
반응형

댓글