/* Chris McKnight UVA 11847: Cut the Silver Bar 11/9/11 */ #include <iostream> #include <cmath> #define DEBUG if(false) using namespace std; int main(int argc, char* argv[]) { int n; cin >> n; while (n != 0) { DEBUG cout << n << " = "; // uses change of base formula cout << (int)(log(n)/log(2)) << endl; // uses builtin math function //cout << (int)(log2(n)) << endl; cin >> n; } return 0; }The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Isaac Traxler