Decimal to binary conversion
| 4 | |
| 5 | // Decimal to binary conversion |
| 6 | int main() |
| 7 | { |
| 8 | int n; |
| 9 | cin>>n; |
| 10 | int ans = 0; |
| 11 | int i = 0; |
| 12 | while(n != 0) |
| 13 | { |
| 14 | int bit = n&1; |
| 15 | ans = (bit * pow(10, i)) + ans; |
| 16 | n = n >> 1; |
| 17 | i++; |
| 18 | } |
| 19 | cout<<ans; |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected