microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.58k stars 29.03k forks source link

Error in calculating 5 cube to check weather 153 is armstrong number or not #192122

Closed Devk1109 closed 1 year ago

Devk1109 commented 1 year ago

Type: Bug

I wrote a code to check weather 153 is a armstrong number or not(It is an armstrong number) as per a question in vs code . when i print cube of every digit using pow it show 5 cube as 124 instead of 125.while same code run perfectly on Devc++ software. but other cubes are correct Code is provided below for your ease to confirm my problem

include

include

int main(){ int i=153,a,ans=0,n=0; a=i; while(a>0){ n=pow((a%10),3); printf("cube of each digits \n%d",n); ans+=n; a/=10;} if(i==ans){ printf("\n%d",ans);} return 0;}

VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z) OS version: Windows_NT x64 10.0.23536 Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz (4 x 2995)| |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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|7.75GB (1.19GB free)| |Process Argv|--crash-reporter-id 10b0f727-de92-42e6-8eb1-a3bfc470a2bb| |Screen Reader|no| |VM|0%|
Extensions (9) Extension|Author (truncated)|Version ---|---|--- code-runner|for|0.12.0 c-cpp-runner|fra|8.1.0 python|ms-|2023.14.0 vscode-pylance|ms-|2023.8.50 cmake-tools|ms-|1.15.31 cpptools|ms-|1.17.5 cpptools-extension-pack|ms-|1.3.0 cmake|twx|0.0.17 vscode-lldb|vad|1.9.2 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 py29gd2263:30792226 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 vsccc:30803844 282f8724:30602487 f6dab269:30613381 showlangstatbar:30737416 03d35959:30757346 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 dsvsc013:30795093 dsvsc014:30804076 diffeditorv2:30821572 ```
gjsjohnmurray commented 1 year ago

/question

vscodenpa commented 1 year ago

We closed this issue because it is a question about using VS Code rather than an issue or feature request. Please search for help on StackOverflow, where the community has already answered thousands of similar questions. You may find their guide on asking a new question helpful if your question has not already been asked. See also our issue reporting guidelines.

Happy Coding!