424,948 Members | 804 Online
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

what's the purpose of the program

 P: n/a void f(int i) { int j; for (j=0;j<16;j++) { if (i & (0x8000>>j)) printf("1"); else printf("0"); } } what's the purpose of the program a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a Aug 14 '07 #1
5 Replies

 P: n/a sumedh..... wrote: void f(int i) { int j; for (j=0;j<16;j++) { if (i & (0x8000>>j)) printf("1"); else printf("0"); } } what's the purpose of the program a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a You are the weakest link. Goodbye. Aug 14 '07 #2

 P: n/a sumedh..... >j)) printf("1"); else printf("0"); } } what's the purpose of the program It's not a program, it's a function. a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a Wrong. Possibly e. neither of the above. but it's impossible to say unless one knows what kind of platform this is supposed to be run on. Regards, Jens -- \ Jens Thoms Toerring ___ jt@toerring.de \__________________________ http://toerring.de Aug 14 '07 #3

 P: n/a On Tue, 14 Aug 2007 03:51:25 -0700, sumedh..... wrote: void f(int i) { int j; for (j=0;j<16;j++) { if (i & (0x8000>>j)) printf("1"); else printf("0"); } } what's the purpose of the program a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a Mine isn't. -- Army1987 (Replace "NOSPAM" with "email") No-one ever won a game by resigning. -- S. Tartakower Aug 14 '07 #4

 P: n/a "sumedh....." >j)) printf("1"); else printf("0"); } } what's the purpose of the program a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a My answer is "Do your own homework." Only one of those answers is conceivably correct, even if you don't know C. Trying the function, which is easy enough, would confirm. If you haven't done so, why do you expect other people to do it for you? S -- Stephen Sprunk "Those people who think they know everything CCIE #3723 are a great annoyance to those of us who do." K5SSS --Isaac Asimov -- Posted via a free Usenet account from http://www.teranews.com Aug 15 '07 #5

 P: n/a sumedh..... wrote: printf("1"); else printf("0"); a. its output is hex representation of i b. bcd c. binary d. decimal my answer is a Think harder. -- pete Aug 15 '07 #6