Simple C Language Program

Source: Internet
Author: User

Simple C Language Program
Evaluate the number of 1 in binary code

# Include <stdio. h> # include <stdlib. h> int count_one_bit (unsigned int num) {int count = 0; while (num) {if (num % 2 = 1) count ++; num = num/2 ;} return count;} int main () {int ret = count_one_bit (255); printf ("% d \ n", ret); system ("pause ");}

 

This program is actually very simple in the C language, but I still feel that I have some details not very clear when I discuss it with my classmates, which means that my C language basics are still not solid. Therefore, I feel that if I want to learn a language well, I must lay a good foundation. I don't care how much I learned, but I must digest the learned knowledge. You need to do more to find out the problems and learn more. This is my first blog. In fact, these words are more for myself. Only when I do it can I be qualified to say it to others. Encourage everyone and cheer up.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.