0

i am getting bunch of zeros as output , no result , i am using mingw as my compiler ,please find error and show me correct way t

here is my source code /************************************************* converting decimal to octal number's **************************************************/ #include <stdio.h> double a[6]; double b; double c[6]; double d[6]; double result; int e; int i; int main() { printf("\n Enter the number to be converted : "); scanf("%d",&a); b = a[0]+a[1]/10+a[2]/100+a[3]/1000+a[4]/10000+a[5]/100000; for ( i = 0; i < 6 ; i++) { d[i] = a[i]/8 ; } for (e = 0; e < 6; e++) { if (e==0) { c[e] = b%8 ; } if (e>0) { c[e] = d[e]%8; } result = c[5]+c[4]/10+c[3]/100+c[2]/1000+c[1]/10000+c[0]/100000; printf("%d",result); getchar(); } return 0; }

25th Sep 2017, 8:54 PM
Hridyansh Thakur
Hridyansh Thakur - avatar
0 Answer