The mantissa moves forward

Source: Internet
Author: User
/* Mantissa forward: Ask for a natural number n, the single digit is 6, 6 refers to the first number of n is four times times as: 1236----->6123? = 4*1236-----> If yes, find it! Problem-solving idea: Divide the natural number into two parts p=123 (that is, 6), the value after q=6 shift: 6*pow (the number of bits of 10,p) + p i.e.: 6*pow (number of bits of 10,p) + p = 4*nq = N%10;p = N/10;p () */#include &L  T;stdio.h> #define Lenth 1000000//range of on-line void fun (int n) {if (n%10 = = 6)//First make sure everyone is 6{int p = N/10;//6 front of the value int q = 6;while (p) {Q *= 10;//6 Front There are several, 6 multiplied by 10 of several square p/= 10; if (q+ (N/10) = = 4*n)//q+p = = 4*n because P has become 0{printf ("%d\n", N) after executing the while loop;}} int main () {for (int. i=0;i<=lenth;++i) {fun (i);} return 0;}

The mantissa moves forward

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.