write the programme that convert a interger to biniry number
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 |
Why do we use using namespace std in c++?
What is jump statement in C++?
Carry out conversion of one object of user-defined type to another?
What is difference between c++ and c ++ 14?
What return value must conversion operators have in their declaration?
What is the use of data hiding?
differance between copy & clon
What is meant by entry controlled loop? What all C++ loops are exit controlled?
Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
Is c++ a dying language?
How can you quickly find the number of elements stored in a dynamic array?
What is #include math h in c++?