-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Closed
Description
Type: Bug
I've written code for converting decimel to binary number and Im getting wrong answer always. I ve Run this code on various other IDE and got right output. I guess it is an issue with VS code. Below is the code
#include
#include
using namespace std;
// //Divison Method
int FindBinary1(int num)
{
int answer = 0;
int i=0;
while(num>0){
int bit = num%2;
answer = (bit*pow(10,i))+answer;
num/=2;
i+=1;
}
return answer;
}
int main()
{
int n;
cin >> n;
int Binary = FindBinary1(n);
cout << Binary << endl;
return 0;
}
and below it wrongly given output
VS Code version: Code 1.75.1 (441438a, 2023-02-08T21:32:34.589Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 x 2096) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 5.94GB (0.85GB free) |
| Process Argv | --crash-reporter-id 6682f3ed-85f5-4eb5-9234-8bb07e9f1f7d |
| Screen Reader | no |
| VM | 0% |
Extensions (7)
| Extension | Author (truncated) | Version |
|---|---|---|
| code-runner | for | 0.12.0 |
| c-cpp-runner | fra | 5.0.0 |
| isort | ms- | 2022.8.0 |
| python | ms- | 2023.2.0 |
| cpptools | ms- | 1.13.9 |
| material-icon-theme | PKi | 4.24.0 |
| vscode-lldb | vad | 1.8.1 |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vscccc:30610679
pyindex848cf:30577861
nodejswelcome1:30587005
3biah626:30602489
pyind779cf:30657577
89544117:30613380
pythonsymbol12:30657548
Metadata
Metadata
Assignees
Labels
No labels