Power Operation (evaluate the power by value), power operation value evaluate the power

Source: Internet
Author: User

Power Operation (evaluate the power by value), power operation value evaluate the power

A value is composed of the following values:

5 = 2 ^ 0 + 2 ^ 2;

40 = 2 ^ 3 + 2 ^ 5;

Now you need to obtain the power values 0, 2, 3, and 5. Int main (int argc, char * argv [])

 

Int main (int argc, char * argv [])

{
@ Autoreleasepool {int bit = 0; int number = 40; while (number! = 0 ){
// Obtain the remainder int I = number % 2;
If (I = 1) {printf ("2 ^ % d \ n", bit);}/*** remove 2 from the right, left shift by 2 decimal shift operation */number = number> 1; bit ++;} return UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppDelegate class]);}

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.