what's the purpose of the program

S

sumedh.....

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
 
M

Mark Bluemel

sumedh..... said:
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.
 
J

Jens Thoms Toerring

sumedh..... said:
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

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
 
A

Army1987

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.
 
S

Stephen Sprunk

sumedh..... said:
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top