TLEJ Posted February 1, 2012 Report Share Posted February 1, 2012 (edited) So I need to write a simple program that takes the user input (int) (Which will be in binary) , and outputs the decimal equivalent. All we have learned so far is printf, scanf_s, if, do, while, int, and all the math functions. We're suppose to do this WITHOUT the use of arrays, and WITH a loop. I have no clue how to do this without arrays.. I know how to convert from binary to decimal and back on paper, but I don't know how to make the computer do this.. Any help would be greatly appreciated! #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int binary, number; printf("Enter binary number: "); scanf_s("%d", &binary); while () { ???????????? } printf("Decimal equivalent is: %d", decimal); return(0); } EDIT: Steve, or any admins, if you see this, could we please change the BG color for code blocks? lol Edited February 1, 2012 by TLEJ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.