Find the five digits whose single digit is 6 and can be divided by three

Source: Internet
Author: User

According to the principle that the total number of users that can be divided by three can also be divided by three, and the single position 6 can be divided by three, so we only need to consider the high level 4, the following method can be used to obtain the final result:

1/* =========================================================== 2 copyright (c) 2014 All Rights Reserved. 3 filename: 3.c 4 Author: Donald 5 Date: 2014/08/16/23 :35:55 6 ==================================== */7 # include <stdio. h> 8 # include <stdlib. h> 9 # include <string. h> 10 11 int main (INT argc, const char * argv []) 12 {13 int index, CNT; 14 for (Index = 1000; index <9999; index ++) {15 if (index % 3 = 0) {16 CNT ++; 17 printf ("% 8d", Index * 10 + 6 ); 18} 19} 20 printf ("\ nresult is % d \ n", CNT); 21 return 0; 22}

 

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.