write the programme that convert a interger to biniry number



write the programme that convert a interger to biniry number ..

Answer / bunny_1996

import java.util.Scanner;
public class HelloWorld{

public static void main(String []args){
Scanner scr=new Scanner(System.in);
int no,i=0,a=0;
int [] x=new int[20];
System.out.println("Enter the decimal number");
no=scr.nextInt();
while(no!=0)
{
a=no%2;
no=no/2;
x[i]=a;
i++;
}
int len=i;
for(i=len-1;i>=0;i--)
{
System.out.print(""+x[i]);
}
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is insertion sorting?

0 Answers  


When there is a global variable and local variable with the same name, how will you access the global variable?

0 Answers  


Where is atoi defined?

0 Answers  


Please explain class & object in c++?

0 Answers  


Explain the isa and hasa class relationships.

0 Answers  






What does catch(…) mean?

0 Answers  


What are manipulators used for?

0 Answers  


To which numbering system can the binary number 1101100100111100 be easily converted to?

0 Answers  


Why c++ is so important?

0 Answers  


Given a simple program designed to take inputs of integers from 1-1000 and to output the factorial value of that number, how would you test this program? You do not have access to the code. Please be as specific as possible.

4 Answers   Microsoft,


What are separators in c++?

0 Answers  


What is a base class?

0 Answers  


Categories