im having a problem w/ the convertion the output is in reverse position..
when i input 10(decimal) the output must be 1010 but in my program the output is 0101
heres my code
#include <iostream>
using namespace std;
int main()
{
long num, total=0,reverse[100],i;
cout << "enter a number: ";
cin >> num;
while(num>0)
{
total = num%2;
num /= 2;
cout << total;
}
system("pause>0");
return 0;
}

New Topic/Question
Reply



MultiQuote





|