C programming Q/A

Q2) You are given two positive integers, say M and N. Check whether M is an exact multiple of N, without using loops. Input ----- Two positive integers, say M and N. Output ------ You have to output 0 if M is not a multiple of N. You have to output 1 if M is a multiple of N.


#include 

int main()
{
    int m, n;
    scanf("%d%d", &m, &n);
    if (m % n == 0)
    {
        printf("1");
    }
    else
    {
        printf("0");
    }
    return 0;
}

Previous Post Next Post