UrbanPro

Take BTech Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

We have as unsigned character like obff and I want program to count no of 1s occur in that character.

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

BEST Technical Trainer & Freelancer

Rotate right or left 8 times thriugh carry and check the flag each time...
Comments

Software Development Professional

unsigned int v; // count the number of bits set in v unsigned int c; // c accumulates the total bits set in v for (c = 0; v; v >>= 1) { c += v & 1; } The naive approach requires one iteration per bit, until no more bits are set. So on a 32-bit word with only the high set, it will go through...
read more
unsigned int v; // count the number of bits set in v unsigned int c; // c accumulates the total bits set in v for (c = 0; v; v >>= 1) { c += v & 1; } The naive approach requires one iteration per bit, until no more bits are set. So on a 32-bit word with only the high set, it will go through 32 iterations. Let me know if you need more detailed explaination. read less
Comments

Programming Guru

You can make a loop attached with a counter and shift right each time. loop testing condition should be (obff!=0). and with the help of count variable you can count number of one's.
Comments

SUDHIR SHARMA - Computer Trainer based On Hyderabad

Dear Siddhant, I am sending a link that can help you to understand the link please open and try to learn, if is there any problem must reply me.. and don't confuse in unsigned int and unsigned char.. you can(put) unsigned char instead of unsigned int..
Comments

JAVA CLASSES IN BANGALORE

Contact me.
Comments

Programmer

Write a if condition that checks the every index of the string with 1. If the condition is true then increase the count variable value by one. Count variable must declared at the beginning of the program itself.
Comments

Programmer

Write a if condition that checks each and every index of string with 1 until u reach null termination . If the condition is true then increase the value of count variable by one. Count variable must be declared at the beginning of the program. At last print the count variable. That's it. Have fun with...
read more
Write a if condition that checks each and every index of string with 1 until u reach null termination . If the condition is true then increase the value of count variable by one. Count variable must be declared at the beginning of the program. At last print the count variable. That's it. Have fun with programs. read less
Comments

View 5 more Answers

Related Questions

Is joining coaching mandatory in class 12?
Though it is self decision to join or not to join to coaching class.The question arise not joining class will save time.If one join the coaching of his own will never be waste of time.as he learn in coaching class.
Hrhrh
After BTech which is better, an MTech or MBA?
M.tech. will be best and all thing depends on your college and interest.
Nitesh
0 0
7
Should I join JEE coaching in class 12?
I THINK NO, WHY Because you need to focus on your Board exam and try to get good marks status and also you can give jee exam with this. If you have good marks in plus 2, you will be able to find the better...
Latha
0 0
5
Tell me about digital image processing?
Captured image is considered as a 2D data array and processed using 2D signal processing techniques.
Preeti

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Description of an Algorithm
What is an Algorithm? An Algorithm is a step-by-step procedure, which defines a set of rules to be executed in a specific order to get the desired output. Characteristics of Algorithm: Language independent Feasible Unambiguous Finiteness Well-define...
P

How to start writing a program using a Language like C?
Usually the starters get confused of certain things like which proagramming tool they would use and why. Like where should one use "for" loop and where to use "while". However, the most common problem...

diffetent tests on coarse aggregate?
In order to decide the suitability of the aggregate for use in pavement construction, the following tests are carried out: Crushing test. Abrasion test. Impact test. Soundness test. Shape test. Specific...

How To Achieve Career Goals In IT Industry?
To become a successful person you must have some goals in your career. It can be easy to achieve your goals if you have well-defined goals that can be achieved in the defined time duration. These goals...

Best Approach to Learn Blender 3D
The necessary mindset to learn Blender is to have a sense of curiosity and fun. Blender, today is professional-grade software. The opening screen of Blender would be daunting. You would feel that it is...

Recommended Articles

MBA, Medicine and engineering are the three main professional courses in India. Engineering is still one of the highly sorted after professional courses in the under graduate level, while MBA is favoured as a preferred post graduate course. To shine in these courses, one needs to work and study hard. Engineering as a...

Read full article >

According to a recent survey conducted by the NCAER (National Council of Advanced Economic Research), engineering is the most sought after course in India. Some engineering courses are offered as BE or Bachelor of Engineering while some as Bachelor in Technology or B.Tech. Since engineering is a professional course, the...

Read full article >

Appearing for exams could be stressful for students. Even though they might have prepared well, they could suffer from anxiety, tension etc. These are not good for their health and mind. However, following a few exam preparation tips can save them from all these and help them to score good marks. Let’s find out all...

Read full article >

While schools provide formal education to the children, the home is where they start learning about things informally. Parents think that schools will take the initiative to educate their children. Well, this is partially true, as parents also play an essential role in bringing up their child. For the development of particular...

Read full article >

Looking for BTech Tuition ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for BTech Tuition Classes?

The best tutors for BTech Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take BTech Tuition with the Best Tutors

The best Tutors for BTech Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more