Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

describe private access specifiers?

1157


Which programming language is best to learn first?

1025


What is scope resolution operator in c++ with example?

1003


Explain the advantages of using friend classes.

1108


What does asterisk mean in c++?

1080


Should the member functions which are made public in the base class be hidden?

985


What is vector string in c++?

1055


Explain linked list using c++ with an example?

1034


What is srand c++?

1071


Why would you use pointers in c++?

1114


what is a class? Explain with an example.

1113


What is the best c++ book for beginners?

1107


What are mutator methods in c++?

1129


When is the copy constructor called?

1099


Describe new operator and delete operator?

1037