to input an unsigned integer and reverse the first and last nibble of the number

## All 16 Replies

SO ? what ?

Post the code, that you have written.

i am not getting a solution for this question , Any help is appreciated. thanks.

hii decptikon if ur der please give me a solution

hey, please don't ask directly for codes. I know nobody will give codes here. WE can help you in your doubts , nut can't do these type of homeowrks.

can i know the logic how its work

I am not geeting one thing that "why are you not trying yourself first?" why are you so lazy for this ? thanks

And why is the kettle calling the pot black?

oh. WaltP is here. @waltP If this is a joke, then i must laugh for this. haha.ok. And if it is the answer of this question, then I am going from this post as you again will say rude to me which i never want again :-| And if you again doing this comment for insulting me or anyone, then THANKS(because it is in your nature). take care and thanks. GOD BLESS YOU

http://en.wikipedia.org/wiki/The_pot_calling_the_kettle_black actually, WaltP don't know the idiom in proper manner. ;) if he wants yo refer, then http://answers.yahoo.com/question/index?qid=20080713145635AASTlMp . :p and I am going from here as waltP, the great is here :D And now this thread will not be solved because

1.Either he will give the rules and regulations now
2. OR he will talk rudely and say some insultive
3. OR if his pity showers on us, then he will answer in only one line, may be reason is that his each line cost many dollars.
4. OR he is not going to answer now(this one has most chances to occur )
;) Let's see what will be the case now :)

don't know the idiom in proper manner

Then why are you complaining and thinking it's an insult? Touchy, aren't you?

As for the rest of your rant, there was no question to be answered. So, as you guessed in #4, what could I answer?

What the heck does #3 mean? Have you gone crazy?

why are you so lazy for this ?

Why are you being rude to shashikumar? Then call me rude? You may need to understand this concept (पाखंडी)

lol ;) I was quite correct in my guessings. ;)
Case 2 is there as in first line only, you again talked rudely.
Case 3 is there as you again answered in one line only. (2nd line) :-D

REQUEST: @waltP I know as per knowledge , I am nothing in front of you. But sir, this is not good what u always do on posts of beginners like me or this one. I know narue(though sometimes got ridiculous but is not rude), Deceptikon(the best one on this forum), ancient dragon and many others who have may be more knowledge than you dont have any ego or rude behaviour. Will feel high if you never do insult or show rude behaviour with anyone in future. heartly thanks. ;)

You're darn lucky Narue isn't here. Your eyes would burn! You're welcome.

commented: :) +0

okies. I think you are above 60 ;) that's why you talsk like this. If you are not above 60 and still you talk like this, them you need Mr.das kumar pankaji. ;) lolxx.

hii decptikon if ur der please give me a solution

I require that you make an attempt first. The problem statement is also ambiguous. Are you reversing the bits in each nibble or swapping the nibbles? Anyway, without actually solving the problem for you, I can help you visualize the bits of a value with a simple test program:

``````#include "stdio.h"
#include "limits.h"

/*
@description:
Prints the bits from value in the range of [first,last) to stdout.
*/
void show_bits(unsigned long value, unsigned first, unsigned last)
{
if (first > sizeof value * CHAR_BIT ||
last > sizeof value * CHAR_BIT)
{
return;
}

while (last-- > first) {
putchar((value & (1U << last)) ? '1' : '0');

/* Break at the byte boundary for better presentation */
if (last % CHAR_BIT == 0)
putchar(' ');

/*
Break at the nibble boundary too. This places a
double break at the byte boundary.
*/
if (last % (CHAR_BIT / 2) == 0)
putchar(' ');
}

putchar('\n');
}

int main()
{
unsigned long value = 0x1B;

/* Display all bits in the value */
show_bits(value, 0, sizeof(unsigned long) * CHAR_BIT);

/* Display the first 7 bits */
show_bits(value, 0, 7);

return 0;
}
``````

Using this you can actually display the bits directly. Such a function is very useful when experimenting with bit manipulation.

I apologize for my rude behaviour to WAltP, but it is also a request to you that if you don't know answer or in case, you don't want to reply then it's a humble request to you that please don't make joke or mock at me. that's what i want. thanks for your help. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.