作业帮 > 综合 > 作业

帮忙啊!算法编程!3题,英文的,明天下午就交作业了!急急急啊!

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/14 08:55:13
帮忙啊!算法编程!3题,英文的,明天下午就交作业了!急急急啊!
如果可以的话,把流程图截图发给我!(英文)可以发我邮箱963177431@qq.com
1。Develop an algorithm that will take in a list of integers and find the largest odd integer
number and smallest even integer number in the list of positive integers.
For example, if you have the following list L = [1, 2, 5, 10, 8, 15] and run your
algorithm using the list then your algorithm should print:
The largest odd number in the list is 15.
The smallest even number in the list is 2.
2Given two lists, develop an algorithm that checks if the numbers of one list are also
contained in another, second list. If a number in one list is also contained in the second
list, your algorithm should print a message similar to the following: “this number is also
in the second list”.
For example, if you have the following two lists L1 = [0, 2, 4, 7] and L2 = [2, 3, 5, 7]
and if you run the two lists through your algorithm, it should print:
The number 2 from the first list is also in the second list.
The number 7 from the first list is also in the second list.
HINT: You need to use two loop structures to develop this algorithm.
3Write an algorithm which asks the user to enter a number and the program will print
either (a) “the number is a prime number” if the number entered is a prime number or (b)
“the number is not a prime number” if the number entered is not a prime number.
A prime number (or a prime) is a natural number greater than 1 that has no positive
divisors other than 1 and itself. For example, these numbers are all prime numbers: 2, 3,
5, 7, 11, 13, 17, 19; however, these numbers are not prime numbers: 1, 4, 6, 8, 9, 10, 12,
14, 15, 16, 18.
帮忙啊!算法编程!3题,英文的,明天下午就交作业了!急急急啊!
编译后的代码发给你了,这里描述下问题:
1,求最大的奇数和最小的偶数。
2,求第一个数组中的每个元素是否包含在第二个数组。
3,判断输入是否为素数。
希望帮到你,有问题交流啊