+ 2
Help me out with the meaning of :-if(m[i]%3==Ollm[i]%5==0) pls..
2 ответов
+ 19
In simple word
1.(||) This means that if either of the two is correct then one of the two is correct. So if condition will run.
2.(&&) This means if Both will be right then the condition will be work, otherwise not.
if(m[i]%3==0||m[i]%5==0)
It means that
for Exmp:
m[i]=3;
Here the first condition is true! And the second is false.
Than (if) condition was Exicuted becz you use point no 1.😊
+ 11
// Statement : if(m[i]%3==Ollm[i]%5==0)
● making use || indicates that any one of these conditions need to be true[ OR operator]
● m[i] implies element at index i of array named m
● m[i]%3==0 //returns true when m[i] is divisible by 3 else false
● m[i]%5==0 //returns true when m[i] is divisible by 3 else false
//in short, it returns true if m[i] will be divisible by 3 or 5 or both👍
//simple note : if 1st condition is true(ie m[i] comes out to be divisible by 3, then compiler will not check for m[i]%5 as for resilt will be true no matter whether m[i] is divisible by 5 or not).