Use recursive functions to do the following:

Source: Internet
Author: User
At the beginning of the year, Michael Jacob added 20000 yuan to the oil card. it is known that Michael Jacob will refuel 4 times a month at a cost of 350*4 yuan. Every 10 times a three-person refueling service is used, the petrol station will enjoy an off price and a off price. Q: How many times should I recharge the card after I refuel it? What is the balance of the oil card after each refueling? Wang's parents...
  1. At the beginning of the year, Michael Jacob added 20000 yuan to the oil card. it is known that Michael Jacob will refuel 4 times a month at a cost of 350*4 yuan.
    Every 10 times a three-person refueling service is used, the petrol station will enjoy an off price and a off price. Q: How many times should I recharge the card after I refuel it? What is the balance of the oil card after each refueling?

    1. Mr. Wang's parents saved him 20000 yuan of living expenses at school. it is known that Mr. Wang will pay 1500 yuan every month after the bank's interest rate. Assume that the current monthly interest rate is 0.32%.
      So what is the balance after Mr. Smith receives the money? How many times have Mr. Wang finished?

    1. Recursively output the following numbers

    5, 3, 1, 3, 5

Reply content:
  1. At the beginning of the year, Michael Jacob added 20000 yuan to the oil card. it is known that Michael Jacob will refuel 4 times a month at a cost of 350*4 yuan.
    Every 10 times a three-person refueling service is used, the petrol station will enjoy an off price and a off price. Q: How many times should I recharge the card after I refuel it? What is the balance of the oil card after each refueling?

    1. Mr. Wang's parents saved him 20000 yuan of living expenses at school. it is known that Mr. Wang will pay 1500 yuan every month after the bank's interest rate. Assume that the current monthly interest rate is 0.32%.
      So what is the balance after Mr. Smith receives the money? How many times have Mr. Wang finished?

    1. Recursively output the following numbers

    5, 3, 1, 3, 5

Question 1:


  "; If ($ times % 10! = 0 & $ total <350) | ($ times % 10 = 0 & $ total <350*0.7) {return false ;} else {myil ($ total, $ times) ;}} myil ($ total);?>

Result:
1 time, 19650 left
2 times, 19300 left
3 times, 18950 left
4 times, 18600 left
5 times, 18250 left
6 times, 17900 left
Seven times, 17550 left
8 times, 17200 left
9 times, 16850 left
10 times, 16605 left
11 times, 16255 remaining
12 times, 15905 left
13 times, 15555 left
14 times, 15205 left
15 times, 14855 remaining
16 times, 14505 left
17 times, 14155 left
18 times, 13805 left
19 times, 13455 left
20 times, 13210 left
21 times, 12860 remaining
22 times, 12510 left
23 times, 12160 left
24 times, 11810 left
25 times, 11460 left
26 times, 11110 left
27 times, 10760 left
28 times, 10410 left
29 times, with 10060 remaining
30 times, 9815 left
31 times, 9465 remaining
32 times, 9115 left
33 times, 8765 remaining
34 times, 8415 remaining
35 times, 8065 left
36 times, 7715 left
37 times, 7365 left
38 times, 7015 left
39 times, with 6665 remaining
40 times, 6420 left
41 times, 6070 left
42 times, 5720 left
43 times, 5370 left
44 times, 5020 left
45 times, 4670 left
46 times, 4320 left
47 times, 3970 left
48 times, 3620 remaining
49 times, 3270 remaining
50 times, 3025 left
51 times, 2675 left
52 times, 2325 left
53 times, 1975 left
54 times, 1625 left
55 times, 1275 left
56 times, with 925 remaining
57 times, with 575 remaining
58 times, 225 left

Similar principles

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.