Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed You are given two integers, say M and N.

+2 votes
asked Jul 31, 2019 by Arjun pradeep
closed Jan 15, 2023 by Admin
You are given two integers, say M and N.

You must check whether M is an exact multiple of N, without using
loops.
You have to output 0 if M is not a multiple of N.
You have to output M/N if M is a multiple of N.
closed with the note: answered

7 Answers

0 votes
answered Jul 31, 2019 by anonymous
#include<stdio.h>

int m,n;

{

printf("enter the value of m");

scanf("%d",&m);

printf("enter the value of n");

scanf("%d",&n);

if(m%n==0)

{

printf("enter the value of m");

else

printf("enter the value of n");

}

return 0;

}
+1 vote
answered Jul 31, 2019 by Venkata Ashik Kalangi
#include<stdio.h>
int main()
{
    int M,N;
    scanf("%d %d",&M,&N);
    
    if(M%N==0)
        printf("%d",M/N);
    else
        printf("0");
    
    return 0;
}
0 votes
answered Jul 31, 2019 by anonymous
Try checking out the modulus operator.
+1 vote
answered Jul 31, 2019 by chaithu gurivigalla (170 points)
#include <stdio.h>

int main()
{
    int m,n;
    printf("enter m and n values:");
    scanf("%d%d",&m,&n);
    if(m%n==0)
    {
        printf("%d",m/n);
    }
    else
    printf("%d",0);

    return 0;
}
0 votes
answered Jul 31, 2019 by Swetha Vedhagiri (280 points)
int m,n;

if m%n==0:

    print(m/n)

else:

    print(0)
0 votes
answered Jul 31, 2019 by keerthanav666 (300 points)
#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d%d",&m,&n);
    if(m%n!=0)
    printf("0");
    else
    printf("%d",m/n);
    return 0;
}
+1 vote
answered Jan 14, 2023 by Dr.PRIANKA R R (160 points)

//Check whether M is an exact multiple of N, without using loops.

#include<stdio.h>
int main()
{
    int M,N;
    scanf("%d %d",&M,&N);
    
    if(M%N==0)
        printf("%d",(M/N)/2);
    else
        printf("0");
    
    return 0;
}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...