帮忙啊!算法编程!3题,英文的,明天下午就交作业了!急急急啊!
如果可以的话,把流程图截图发给我!(英文)可以发我邮箱963177431@qq.com1。Developanalgorithmthatwilltakeinalistofi...
如果可以的话,把流程图截图发给我!(英文)可以发我邮箱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. 展开
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. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询