




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、visual foxpro程序設(shè)計(jì)練習(xí)題(Visual foxpro程序設(shè)計(jì)練習(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中至少一個(gè)數(shù)整除的所有整數(shù)按從小到大順序排列后, 求前面20個(gè)數(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、若一個(gè)自然數(shù)恰好是它的平方的末后幾位數(shù), 則稱(chēng)此數(shù)為自同構(gòu)數(shù).如5和76都是自同構(gòu)數(shù), 因?yàn)樗鼈兊钠椒椒謩e是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、求滿(mǎn)足條件a * b = 54321且使a + b的值最小的自然數(shù)對(duì)a、b中較小的一個(gè)數(shù). (提示: 設(shè)a = (b), 當(dāng)a越大時(shí)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、對(duì)自然數(shù)a、b、c, 若a b c且a * (a + b) * b = c * c, 則稱(chēng) a, b, c 為一組勾股弦數(shù), 其中a、b、c分別稱(chēng)為勾、股、弦.試求出弦為25000的勾股弦數(shù)組的個(gè)數(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)的所有素?cái)?shù)的個(gè)數(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個(gè)素?cái)?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、編寫(xiě)程序,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、編寫(xiě)程序, 計(jì)算在0 50的范圍內(nèi)有多少個(gè)數(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枚, 問(wèn)共有多少種換法? (注: 在兌換中, 一分、兩分或五分的硬幣數(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兔值錢(qián)1496,4羊2犬6雞3兔值錢(qián)1175,3羊1犬7雞5兔值錢(qián)958,2羊3犬5雞1兔值錢(qián)861, 求雞值多少錢(qián)?答案: 23For a = 1 to 300For B = 1 to 300For C = 1 to 170D = 861 - 2 * 3 * 5 * - B - CIf 4 * 2 *
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 五年級(jí)體育課教學(xué)輔助計(jì)劃他
- 新員工培訓(xùn)培優(yōu)輔差工作計(jì)劃
- 小學(xué)語(yǔ)文學(xué)科競(jìng)賽心得體會(huì)
- 第二學(xué)期小學(xué)教導(dǎo)處德育工作實(shí)施計(jì)劃
- 電力系統(tǒng)員工學(xué)習(xí)張欣同志先進(jìn)事跡心得體會(huì)
- 放射科醫(yī)療質(zhì)量安全事件報(bào)告制度及流程
- 以形促言:聚焦于形任務(wù)在高中英語(yǔ)閱讀課堂的效能探究
- 以客戶(hù)為擎驅(qū)動(dòng)增長(zhǎng):A集團(tuán)大客戶(hù)管理體系的深度剖析與創(chuàng)新實(shí)踐
- 一年級(jí)興趣發(fā)展與德育結(jié)合計(jì)劃
- 2025年華中農(nóng)業(yè)大學(xué)自主招生職業(yè)規(guī)劃個(gè)人陳述范文
- 2024年寧夏銀川金鳳區(qū)社區(qū)專(zhuān)職工作者考試真題
- 《新青年 鄭出發(fā)》打造城市夜經(jīng)濟(jì)文旅美食商業(yè)街運(yùn)營(yíng)規(guī)劃方案
- 普陀區(qū)2024-2025學(xué)年下學(xué)期期末考試六年級(jí)數(shù)學(xué)試卷及答案(上海新教材滬教版)
- 咖啡師考試題庫(kù)
- 2025年中國(guó)水下測(cè)深儀市場(chǎng)調(diào)查研究報(bào)告
- 2025年湖北省中考數(shù)學(xué)試卷
- 2025年湖北省中考英語(yǔ)試卷真題(含答案)
- 2025年陜西省中考數(shù)學(xué)真題含答案
- 2025年春國(guó)家開(kāi)放大學(xué)《馬克思主義基本原理》期末終考試卷1參考答案試卷1
- 2025年供應(yīng)鏈管理專(zhuān)業(yè)考試題及答案
評(píng)論
0/150
提交評(píng)論