c - Different answer in CodeBlocks in windows and Gedit on Linux Decimal to Binary Conversion -


this code of converting decimal binary. when test on cb number 5 , 20 gave me weird answers ( 100, 10098) when tested on gedit on linux, fine ( 101, 10100).

#include <stdio.h> #include<math.h> int main() {     int n;     printf("enter int:");     scanf("%d",&n);     int result=0, c=0;     while(n>0)     {         if(n%2==1){              result += pow(10,c);         }         c++;         n=n/2;     }     printf("%d\n",result); } 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -