Question: I wrote in c++ but it goes infinity . I am sure it is true but I think there must be some little mistakes could
I wrote in c++ but it goes infinity . I am sure it is true but I think there must be some little mistakes could you fix it and explain the code


T 10 -0-0-0- 234567896 #include using namespace std; void binary(int a) { int i; cout < < "0" < < endl; I 11 12 +0- do { for (i = 1; i < a; i/2) { if ((a & i) != 0) { cout < < "1" < < endl; } else { 13 cout < < "0" < < endl; 14 15 } 16 17 } 18 } 19 while (1
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
