Sample Qustion 6

Write a C++ program to convert given decimal number into binary number.

  #include <iostream>
  using namespace std;
  int main()
  {
  int a[10], n, i;
  cout<<"Enter the number to convert: ";
  cin>>n;
  for(i=0; n>0; i++)
  {
  a[i]=n%2;
  n= n/2;
  }
  cout<<"Binary of the given number= ";

  for(i=i-1 ;i>=0 ;i--)
  {
  cout<<a[i];
  }
   
 }





download file  cpp file


do you have any qustion please comment



click the advertisement to help for me ....







Comments

Popular posts from this blog

Java Question Data structure 04

Sample Qustion 1