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
What is the cout in c++?
Why is null pointer used?
Write a program to find the reverse Fibonacci series starting from N.
Write about a nested class and mention its use?
Is java the same as c++?
How the delete operator differs from the delete[]operator?
What is abstract class in c++?
What is a hash function c++?
What does catch(…) mean?
Why iomanip is used in c++?
What are namespaces in c++?
What is the difference between #import and #include in c++?
What is const in c++?
What are pointer-to-members? Explain.
What is the use of :: operator in c++?