




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、visual foxpro程序设计练习题(Visual foxpro程序设计练习题)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中至少一个数整除的所有整数按从小到大顺序排列后, 求前面20个数之和.答案: 20610a = 1001n = 0s = 0do while n 20if mod (a, 4) = 0 or mod (a, 6) = 0s = s + a)n = n + 1endifa = a + 1enddo? s21、若一个自然数恰好是它的平方的末后几位数, 则称此数为自同构数.如5和76都是自同构数, 因为它们的平方分别是25和5776.求 299999 内所有自同构数之和.
12、(提示: 若x是m位同构数, 则x的平方除以10的m次方的余数就是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的值最小的自然数对a、b中较小的一个数. (提示: 设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、对自然数a、b、c, 若a b c且a * (a + b) * b = c * c, 则称 a, b, c 为一组勾股弦数, 其中a、b、c分别称为勾、股、弦.试求出弦为25000的勾股弦数组的个数.答案: 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内的所有素数的个数 (素质是指只能被1和本身整除的数).答案: 21n = 0for i = 100 to 200for j = 2 to i - 1if (i% j = = 0)exitendifendforif j = = in = n + 1endifendfor? n29、求100010000内的第50个素数 (素质是指只能被1和本身整除的数).答案: 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的范围内有多少个数, 其每位数的乘积大于每位数的和.答案: 23N = 0For I = 0 to 50A = Int (1 / 10)I B = 10%If a * B a + BN = N + 1EndifEndfor? N44、用一元纸币兑换一分、两分和五分的硬币
21、, 要求兑换硬币的总数为60枚, 问共有多少种换法? (注: 在兑换中, 一分、两分或五分的硬币数可以为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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025岗位安全培训考试试题真题汇编
- 西安建筑科技大学华清学院《外科护理学实训》2023-2024学年第二学期期末试卷
- 聊城大学《环境污染事件应急监测与处理》2023-2024学年第二学期期末试卷
- 江苏省苏州市张家港第一中学2025年初三数学试题一模试题含解析
- 上海中医药大学《测量平差基础》2023-2024学年第二学期期末试卷
- 酒泉职业技术学院《地理信息系统导论》2023-2024学年第二学期期末试卷
- 武汉航海职业技术学院《国际组织》2023-2024学年第二学期期末试卷
- 梧州学院《园艺产品品质分析》2023-2024学年第二学期期末试卷
- 辽宁省葫芦岛市六校协作体2025年高三年级第一次校模拟考试英语试题含解析
- 上海市嘉定区市级名校2024-2025学年高三5月月考调研物理试题含解析
- 《食品生产经营企业落实食品安全主体责任监督管理规定》解读与培训
- 广东省深圳市南山外国语学校等学校联考2023-2024学年七年级下学期期中数学试题
- 安全施工作业票(模版)
- 项目部施工管理实施计划编制任务分工表
- 【2021部编版语文】-三年级下册第七单元教材解读--PPT课件
- 橙色黑板风小学生知识产权科普PPT模板
- 中国供销合作社标识使用手册课件
- Q∕CR 9218-2015 铁路隧道监控量测技术规程
- 甲状腺解剖及正常超声切面ppt课件
- 上海市城市地下空间建设用地审批及房地产登记试行规定
- 蠕墨铸铁项目可行性研究报告写作范文
评论
0/150
提交评论