English, asked by narayana02061998, 2 months ago

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
rinin two noso gas
Integer n, i = 3, count, c
Input n
for count=2 up to n
for cy= 2 up to i - 1
if (i % c equals 0)
Go out of the loop
end for
if (c equals i)
print i
count count + 1
end if
end
None of the mentioned options​

Answers

Answered by s1261aditi5623
1

Answer:

don't send unknown questions sir pls and be safe

Answered by jayeetaadhikari18751
0

Answer:

Write an Efficient Method to Check if a Number is Multiple of 3

The very first solution that comes to our mind is the one that we learned in school. If sum of digits in a number is multiple of 3 then number is multiple of 3 e.g., for 612 sum of digits is 9 so it’s a multiple of 3. But this solution is not efficient. You have to get all decimal digits one by one, add them and then check if sum is multiple of 3.

Recommended: Please solve it on “PRACTICE” first, before moving on to the solution.

There is a pattern in binary representation of the number that can be used to find if number is a multiple of 3. If difference between count of odd set bits (Bits set at odd positions) and even set bits is multiple of 3 then is the number.

Example : 23 (00..10111)

1) Get count of all set bits at odd positions (For 23 it’s 3).

2) Get count of all set bits at even positions (For 23 it’s 1).

3) If difference of above two counts is a multiple of 3 then number is also a multiple of 3.

(For 23 it’s 2 so 23 is not a multiple of 3)

Take some more examples like 21, 15, etc…

Mark as me brainlist

Similar questions