2015-11-18T04:00:24-05:00
Write a program that asks the user to enter a number in decimal then displays it in binary
and hexadecimal.
1
2015-11-19T04:42:20-0500
#include <iostream> using namespace std; void hexaD(int a, char b); int main(){ int number; cout<<"Please enter Number : "; cin>>number; int bankint[20]; int totalint=-1; for(int q=0;number>0;q++){ if((number%2) == 0) bankint[q]=0; else bankint[q]=1; totalint++; number/=2; } cout<<"Number binary = "; for(int j=totalint;j>=0;j--) /* reversved */ cout<<bankint[j]; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments