0

Pls give some idea for below questions..?

You are given two integers, say M and N.You must check whether M is an exact multiple of N, without usingloops. 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

7th Sep 2018, 11:07 AM
Vignesh
Vignesh - avatar
4 Antworten
+ 2
Not really. Also it doesn't matter if it is homework or not. He even explicitely only asked for a hint. If you just mention to use %, he still has to figure out the condition and case distinction. For beginners getting used to the syntax and building small codes from scratch is better for learning and understandig (due to encountered problems during coding) than just copy some code.
7th Sep 2018, 11:29 AM
Matthias
Matthias - avatar
+ 1
hinanawi idea, not whole code please... modulus operator / % / rest / remainder as keywords or so
7th Sep 2018, 11:22 AM
Matthias
Matthias - avatar
+ 1
Matthias well the code is basic to the point where explaining it is the same as just showing it, so it doesn't really matter when it comes to a question like this. this doesn't really look like homework either, probably an assignment the OP found somewhere
7th Sep 2018, 11:25 AM
hinanawi
hinanawi - avatar
0
if(m % n == 0) printf("%d", m/n); else printf("%d", 0); is this what you're looking for?
7th Sep 2018, 11:17 AM
hinanawi
hinanawi - avatar