Home > Back-end >  C, why to prove that two integers a and b are equal, can't write a % b==0
C, why to prove that two integers a and b are equal, can't write a % b==0

Time:10-13

Output an integer sequence with a specified number of the same number, the number of the input contains 2 lines: 1 N and m, according to the sequence of integers length (N 100) or less, and the specified number; Act 2 N integers, integers separated with a space between the output for the number of N and m the number of the same number,

[enter]
1 N and m, said the sequence of integers length (N 100) or less, and the specified number, separated by a space;

Act 2 N integers, integers separated with a space between,

CodePudding user response:

10 is equal to 5? But 10% 5 equal to zero

CodePudding user response:

A % b==0 means a aliquot b, can't judge a must be equal to b, such as 4 can be divided exactly by 2, 4 but not equal to 2
Whether two integer equal, direct==ok, a==b

CodePudding user response:

Good?? Thank you for the

CodePudding user response:

Can be used to determine two equal Numbers, but with a large number to beg, so, to write the if (a CodePudding user response:

(a % b==0 & amp; & A/b==1), for this I do not know can not

The same a ^ b==0

CodePudding user response:

Lin2 zi3 da4 shrimp bird all have, so, just to verify,
Int a=2, b=4; cout <((a & lt; B? A % b: b %)==0) & lt;

CodePudding user response:

refer to 6th floor wise men know already should good karma response:
cout & lt; <((a & lt; B? A % b: b %)==0) & lt;
lin2 zi3 da4 shrimp bird has
Don't talk about what's in this code to verify
Don't talk about it ends
Only consider the correctness of the code itself are all GG
Fault code undefined behavior results less meaningless word perpetuated this misunderstanding

CodePudding user response:

references a wise man should know already take good karma, 4/f, response:
2 equal Numbers can be used to judge, but with a large number to beg, so, to write the if (a


In order to determine the two Numbers are equal, to write so long? !

Draw a snake and add eight legs oh

CodePudding user response:

A % b==0 is proved a aliquot b
The right should be a==b