decimal to binary converter
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int ans = 0;
int i = 0;
while (n != 0)
{
int bit = (n & 1);
ans = ans + (bit * pow(10, i)) ;
n = n>>1;
i++;
}
cout << ans;
return 0;
}
if i am using online compiler it is working correctly but if i use vs code then for digit 5 it is giving 100 instead of 101