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 does obj stand for?
What is increment operator in c++?
Which bit wise operator is suitable for checking whether a particular bit is on or off?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
Eplain extern keyword?
What is private inheritance?
How java is different from c and c++?
What happens when you make call 'delete this;'?
What is #include cstdlib in c++?
What are the basics of local (auto) objects?
What are structs in c++?
What is a catch statement?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
Describe new operator?
What is the use of "new" operator?