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

Can a program run without main?

1328


What is string in c++ programming?

1274


Is c++ primer good for beginners?

1085


What is the basic structure of c++ program?

1153


What kind of problems can be solved by a namespace?

1134


What are the methods of exporting a function from a dll?

1296


Why do we use vector in c++?

1123


Array base access faster or pointer base access is faster?

2358


What is a v-table?

1229


Explain what is class definition in c++ ?

1196


What is the disadvantage of using a macro?

1173


What are the various situations where a copy constructor is invoked?

1177


Why is swift so fast?

1176


Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.

1111


What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero

1152