visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)_第1頁
visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)_第2頁
visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)_第3頁
visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)_第4頁
visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)_第5頁
已閱讀5頁,還剩28頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、visual foxpro程序設(shè)計練習(xí)題(Visual foxpro程序設(shè)計練習(xí)題)Visual FoxPro programming exercises3, seek the maximum natural number n within 100, so that the sum of the reciprocal of the successive n natural numbers from 1 is less than 3.5.Answer: 18S=0For i=1 to 100S=s+1/iIf s=3.5ExitEndiENDFI-1?5, to find within 100,

2、 making the formula 1*2+2*3+. The maximum natural number n of +n* (n+1) is less than 5000.Answer: 23S=0For i=1 to 100S=s+i* (i+1)If s=5000ExitEndiENDFI-1?7, a country with a population of 100 million this year, if the annual rate of 4% increments, try to find out, at least in a few years, the countr

3、ys population will double.Answer: 18N=0X=1Do while x2X=x* (1+0.04)N=n+1EnddoN?8, set geometric series: 1, 3, 9, 27,. The minimum natural number n that makes the sum of the first n term of this sequence greater than 2345678.Answer: 14S=0N=0Do while s=2345678S=s+3nN=n+1EnddoN?9, for 45678 of all non t

4、rivial factors (i.e. except 1 and itself a number of factors) is odd.Answer: 7N=0S=45678For i=3 to 22839 step 2If mod (s, I) =0N=n+1EndifEndforN?10, find all the true factor 203267 (i.e. less than its maximum number of divisors) factor.Answer: 6557S=203267For, i=1, to, int (203267/3)If mod (s, I) =0

5、N=iEndifEndforN?11, calculate the greatest common divisor of 20677 and 42067.Answer: 713For i=20677 to 1 step -1If, mod (20677, I), =0, and, mod (42067, I) =0ExitEndifEndforI?13, seek all the minimum two digit AB (a*10+b) that matches the formula ab*ba=2701. Among them, a and B are integers between

6、19.Answer: 37For a=1 to 9For b=1 to 9If (a*10+b) * (b*10+a) =2701A*10+b?ReturnEndifEndforEndfor14, known sequence: 1,2,4,7,11,16,. The law is that the difference between the two adjacent items is 1,2,3,4,5,. Try to find the smallest item in this series greater than 5000.Answer: 5051A=1N=1Do while a5

7、000A=a+nN=n+1EnddoA?15, the known sequence f (n),:f (1) =1, f (2) =4, when n=3,4,5,. Time, f (n), =3*f (n-1), -f (n-2). Try to find the smallest natural number n within 100, so that the term n of this series is greater than 87654321.Answer: 20Dimension f (100)F (1) =1F (2) =4N=2Do while f (n) 876543

8、21N=n+1F (n), =3*f (n-1), -f (n-2)EnddoN?16, a ball from 100 meters high fell to the ground, and repeatedly re bounce down again, assuming that each rebound height is the height of the previous 3/4 times, try to derive the maximum number of N, the total distance from the ball began to fall to the gr

9、ound when the N in the vertical direction through no more than 690 meters.Answer: 15H=100S=100N=1Do while s690H=h*3/4S=s+2*hN=n+1EnddoN-1?17, set the 26 letters that are represented by 26 letters: a=1, b=1/ (a+1), and c=1/ (b+2),. Z=1/ (y+25). Try to find the number of letters in the 26 letters whos

10、e value is less than 0.1.Answer: 16A=1N=0For i=1 to 25A=1/ (a+i)If a0.1N=n+1EndifEndforN?19. Seek the sum of the numbers in 100999 that do not contain the number 0 and the product of which the numbers are divisible by 96.Answer: 26640S=0For a=1 to 9For b=1 to 9For c=1 to 9If (mod (a*b*c),96) = 0)s =

11、 s + a) * 100 * 10 + (c) + (b)ownendfendfendf? s20、將大于1000且能被4和6中至少一個數(shù)整除的所有整數(shù)按從小到大順序排列后, 求前面20個數(shù)之和.答案: 20610a = 1001n = 0s = 0do while n 20if mod (a, 4) = 0 or mod (a, 6) = 0s = s + a)n = n + 1endifa = a + 1enddo? s21、若一個自然數(shù)恰好是它的平方的末后幾位數(shù), 則稱此數(shù)為自同構(gòu)數(shù).如5和76都是自同構(gòu)數(shù), 因為它們的平方分別是25和5776.求 299999 內(nèi)所有自同構(gòu)數(shù)之和.

12、(提示: 若x是m位同構(gòu)數(shù), 則x的平方除以10的m次方的余數(shù)就是x)答案: 101114s = 0for i = 2 to 999999if mod (i * i, 10) or mod (i) = i * i, 100) or mod (i * = i = i i, 1000) or mod (i * i, 10000) or mod (i * = i = i i, 100000)s = s + iendifendfor? s22、求滿足條件a * b = 54321且使a + b的值最小的自然數(shù)對a、b中較小的一個數(shù). (提示: 設(shè)a = (b), 當a越大時a + b越小)答案: 57

13、s1 = 54322for i = 1 to int (sqrt (54321)if (54321% i = = 0)s = i + 54321 / iif (s, 0if (c% 2 = = 1)n = n + 1endif(c) = int (c) / 2)enddo? n25、對自然數(shù)a、b、c, 若a b c且a * (a + b) * b = c * c, 則稱 a, b, c 為一組勾股弦數(shù), 其中a、b、c分別稱為勾、股、弦.試求出弦為25000的勾股弦數(shù)組的個數(shù).答案: 5n = 0for b = 12500 to 25000for a = 1 to b - 1if a * b

14、 = a + b * * 25000 25000n = n + 1endifendforendfor? n26、求方程3x - 7y = 1在條件 | x y 75364321exitendifendfor? n28、求100200內(nèi)的所有素數(shù)的個數(shù) (素質(zhì)是指只能被1和本身整除的數(shù)).答案: 21n = 0for i = 100 to 200for j = 2 to i - 1if (i% j = = 0)exitendifendforif j = = in = n + 1endifendfor? n29、求100010000內(nèi)的第50個素數(shù) (素質(zhì)是指只能被1和本身整除的數(shù)).答案: 13

15、61n = 0for i = 1000 to 10000.for j = 2 to i - 1if (i% j = = 0)exitendifendforif j = = in = n + 1endifif (n = = 50exitendifendfor? i30、編寫程序,How many such numbers are computed within 10000, with a single digit of 6 and the number divisible by 9.Answer: 111N=0For i=1 to 10000If i%10=6 and i%9=0N=n+1End

16、ifEndforN?31, set a number of four digits of the sum of squares is equal to 100, ask how many of these four figures?Answer: 49N=0For i=1000 to 9999A=int (i/1000)B=int (i/100)%10C=int (i/10)%10D=i%10If a2+b2+c2+d2=100N=n+1EndifEndforN?32, to a one dollar bill, replaced by a point, two points and five

17、 points coins, each at least 11, and asked how many kinds of programs?Answer: 13N=0For a=11 to 20For b=11 to 50For c=11 to 100If a*5+b*2+c=100N=n+1EndifEndforEndforEndforN?33, to a one dollar bill, replaced by a point, two points and five points coins, each at least 1 pieces, the total number of coi

18、ns asked after the exchange with the least number of gold coins in total difference is how much?Answer: 73Max=3Min=300For a=1 to 20For b=1 to 50For c=1 to 100If a*5+b*2+c=100S=a+b+cIf (smax)Max=sEndifIf (smin)Min=sEndifEndifEndforEndforEndforMax-min?34, to find the following conditions: X2+Y2=412 an

19、d X+Y value of the largest two positive integers X, Y, the value of X+YAnswer: 49Max=41For x=1 to 41For y=x to 41If x*x+y*y=41*41 and max500ExitEndifEndifEndforS?40, if a number coincides with all its factors and equal, claimed that the number one end of a few, such as: 6=1+2+3, 6 is a perfect numbe

20、r. For 200 to 500 of all completed and.Answer: 496Sum=0For i=200 to 500S=0For j=1 to I-1If i%j=0S=s+jEndifEndforIf S = rSum = SUM + IEndifEndfor? Sum43、編寫程序, 計算在0 50的范圍內(nèi)有多少個數(shù), 其每位數(shù)的乘積大于每位數(shù)的和.答案: 23N = 0For I = 0 to 50A = Int (1 / 10)I B = 10%If a * B a + BN = N + 1EndifEndfor? N44、用一元紙幣兌換一分、兩分和五分的硬幣

21、, 要求兌換硬幣的總數(shù)為60枚, 問共有多少種換法? (注: 在兌換中, 一分、兩分或五分的硬幣數(shù)可以為0枚)答案: 11N = 0For a = 0 to 20For B = 0 to 50A - B - C = 60If a * B * 5 + 2 + C = 100N = N + 1EndifEndforEndfor? N46、有5羊4犬3雞2兔值錢1496,4羊2犬6雞3兔值錢1175,3羊1犬7雞5兔值錢958,2羊3犬5雞1兔值錢861, 求雞值多少錢?答案: 23For a = 1 to 300For B = 1 to 300For C = 1 to 170D = 861 - 2 * 3 * 5 * - B - CIf 4 * 2 *

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論