write the programme that convert a interger to biniry number
Answer Posted / 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 View All Answers
describe private access specifiers?
Which programming language is best to learn first?
What is scope resolution operator in c++ with example?
Explain the advantages of using friend classes.
What does asterisk mean in c++?
Should the member functions which are made public in the base class be hidden?
What is vector string in c++?
Explain linked list using c++ with an example?
What is srand c++?
Why would you use pointers in c++?
what is a class? Explain with an example.
What is the best c++ book for beginners?
What are mutator methods in c++?
When is the copy constructor called?
Describe new operator and delete operator?