+ 1

Selective operation loop in cpp?

How can I create a loop in cpp such that if a given number is even, it divides it by 2 and if it is odd it multiplies it by 3 and adds 1 (3n+1)stuff until the number becomes 1 ?(I want all the values in between).

8th Aug 2021, 4:46 AM
Ishan Kumar Gupta
Ishan Kumar Gupta - avatar
1 ответ
8th Aug 2021, 5:15 AM
JaScript
JaScript - avatar