•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 456,501 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,671 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 1286 | Replies: 9
![]() |
•
•
Join Date: Mar 2007
Location: Israel
Posts: 16
Reputation:
Rep Power: 2
Solved Threads: 1
Here, Google's wonders:
http://mistupid.com/computers/binaryconv.htm
Or do you want the source code to that?
http://mistupid.com/computers/binaryconv.htm
Or do you want the source code to that?
•
•
Join Date: Jan 2007
Location: Istanbul / Turkey
Posts: 22
Reputation:
Rep Power: 2
Solved Threads: 0
read this: http://www.daniweb.com/code/snippet109.html
•
•
Join Date: Sep 2007
Location: Tirgu-Mures Romania
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 0
int x[11];
int i=11,decimal=0;
for(i=0;i<11;i++)
/*here to allow the user to enter 11 binary numbers*/
scanf("%d",&x[i]);
for(i=10;i>=0;i--)
{
if(a[i]==1)
decimal+=2 * i ;
}
printf("your decimal number is %d",decimal);It is working....
Change your thought and the world around you changes.
"In a moment, everything can change. Feel the wind on your shoulders.
For a minute, all the world can wait. Let go of your yesterday. " H.Duff-Fly
Anything is possible
"In a moment, everything can change. Feel the wind on your shoulders.
For a minute, all the world can wait. Let go of your yesterday. " H.Duff-Fly
Anything is possible
•
•
Join Date: Aug 2007
Posts: 22
Reputation:
Rep Power: 2
Solved Threads: 0
sorry jokerjokerer what I have done is not correct How!!!!.
let's say we have this binary number00000000001 by the privous programming gives the result equal to 2048 and that is wrong the correct decimal is 1 not 2048 . therefore I would correct my answer by the following programe
and please if you get it reply to me thanks
#include<stdio.h>
#include<math.h>
int main()
{
int k=-1,i=0,decimal=0;
int a[11];
printf("please enter 11 binary numbers");
for(i=0;i<11;i++)
//to allow user enter 11 binary numbers
scanf("%d",&a[i]);
if(a[i]==1)
{
k++;
decimal+=power(2,k);
}
else
k++;
return 0;
}
//please as soon as you get it tell me that.
// sorry for my mistak
let's say we have this binary number00000000001 by the privous programming gives the result equal to 2048 and that is wrong the correct decimal is 1 not 2048 . therefore I would correct my answer by the following programe
and please if you get it reply to me thanks
#include<stdio.h>
#include<math.h>
int main()
{
int k=-1,i=0,decimal=0;
int a[11];
printf("please enter 11 binary numbers");
for(i=0;i<11;i++)
//to allow user enter 11 binary numbers
scanf("%d",&a[i]);
if(a[i]==1)
{
k++;
decimal+=power(2,k);
}
else
k++;
return 0;
}
//please as soon as you get it tell me that.
// sorry for my mistak
![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- binary to decimal in c++ code (C++)
- How do I Take in Hexidecimal input out put binary, decimal, and octal (Java)
- Converting binary code to decimal value. (C++)
- i need code for binary to decimal (it should be written in 'C') (C)
Other Threads in the C Forum
- Previous Thread: question in return string
- Next Thread: Char occurrence issue



Linear Mode