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



write the programme that convert a interger to biniry number ..

Answer / 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

More C++ General Interview Questions

Explain the difference between class and struct in c++?

0 Answers  


What does std mean in c++?

0 Answers  


const char * char * const What is the differnce between the above two?

11 Answers   TCS,


Do we have private destructors?

12 Answers   Symphony, TCS,


what is upcasting in C++?

0 Answers  


Differences between private, protected and public and give examples.

0 Answers  


Should I learn c++ c?

0 Answers  


What are the classes in c++?

0 Answers  


What is the oldest programming language?

0 Answers  


What are the basic data types used in c++?

0 Answers  


What is c++ & why it is used?

0 Answers  


What is the difference between prefix and postfix versions of operator++()?

0 Answers  


Categories