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 flush c++?
What is the limitation of cin while taking input for character array?
Explain abstraction.
What is a stack c++?
How much is c++ certification?
How do you declare A pointer to a function which receives nothing and returns nothing
What is the basic of c++?
What is a pdb file?
How we can differentiate between a pre and post increment operators during overloading?
What is setf in c++?
Is python better than c++?
How would you use the functions sin(), pow(), sqrt()?
What is pointer with example?
What is function overloading in C++?
What are formatting flags in ios class?