473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

need the logc to binary conversion program

hi plz send me the logic for the binary convertio program
Jul 17 '06 #1
3 2915
Banfa
9,065 Expert Mod 8TB
What binary conversion?

Expand|Select|Wrap|Line Numbers
  1. int a,b;
  2.  
  3. b = 4276;
  4.  
  5. a = ~b;
  6.  
here's the logic for a program to invert all the bits of the value 4276.
Jul 17 '06 #2
hi plz send me the logic for the binary convertio program

I couldn't understand ur question, if u r asking the logic of printing the binary form of a decimal value then here is the logic.

unsigned short int i = 2, k = 0;

for(int j=0;j<16;j++)
{
k = i<<j;
printf("%d",k>>15);
}
getch();

the above code will print the binary form of the value of i.
Jul 18 '06 #3
#include<stdio.h>
#include<conio.h>
void main()
{

int num;
int i,,j,cnt=0,arr[16];
int k;
clrscr();
printf("\n enter the number:");
scanf("%d",&num);
for(i=0;num>0;i++)
{
bin=num%2;
num=num/2;
arr[i]=bin;
cnt++;
}

printf('\n the number is :");
for(j=0;j<=cnt;j++)
{
k=(cnt-1)-j;
printf("%d',arr[k]);
}



getch();

}
Sep 25 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Idar | last post by:
Is there an effecient/fast way in python to convert binary data from file (24bit hex(int) big endian) to 32bit int (little endian)? Have seen struct.unpack, but I am unsure how and what Python has...
103
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it...
2
by: michael.rygh | last post by:
This is just one of the sources for a project that deals with a library. I am having problems, here is the errors. all these.. i belive it has something to do with it needs a subscript? but i'm...
24
by: Fumeur | last post by:
Is the following program standard conform? (reduced as much as possible so it still shows the problem) /* begin */ #include <stdio.h> void xfprintf(FILE *); void xfprintf(FILE *f) {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.