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

What does obj stand for?

1092


What is increment operator in c++?

971


Which bit wise operator is suitable for checking whether a particular bit is on or off?

973


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

2020


Eplain extern keyword?

980


What is private inheritance?

1047


How java is different from c and c++?

1156


What happens when you make call 'delete this;'?

1032


What is #include cstdlib in c++?

1142


What are the basics of local (auto) objects?

1081


What are structs in c++?

971


What is a catch statement?

987


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1039


Describe new operator?

1097


What is the use of "new" operator?

1071