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 |
Explain the difference between class and struct in c++?
What does std mean in c++?
const char * char * const What is the differnce between the above two?
Do we have private destructors?
what is upcasting in C++?
Differences between private, protected and public and give examples.
Should I learn c++ c?
What are the classes in c++?
What is the oldest programming language?
What are the basic data types used in c++?
What is c++ & why it is used?
What is the difference between prefix and postfix versions of operator++()?