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

What is difference between c++ and c ++ 14?

0 Answers  


write a program that takes 5 digit no and calculate 2 power that no and print it.

3 Answers  


In a function declaration, what does extern mean?

0 Answers  


Define macro.

0 Answers  


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

0 Answers  


Explain the use of vtable.

0 Answers  


What is the difference between while and do while loop? Explain with examples.

0 Answers  


Why the usage of pointers in C++ is not recommended ?

0 Answers   TCS,


Is c++ the most powerful language?

0 Answers  


When one must use recursion function? Mention what happens when recursion functions are declared inline?

0 Answers  


Write a C++ program to sort digits of all the 4 digit number and display the sorted 4 digit number

1 Answers   TATA, TCS,


What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number

0 Answers  


Categories