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 |
What is the use of endl in c++?
Should I learn c or c++ first?
Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }
Does c++ have foreach?
What is buffering in c++?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
What is a float in c++?
Why do we use classes in c++?
Is string data type in c++?
Which operator cannot overload?
What is an undefined behavior and sequence points
What is the use of class in c++?