• Write a C++ code segment to add the first 20 positive integer values (1 + 2 + 3 + ... + 20) and to output the result.
• Write a C++ code segment to read a double precision floating-point value and to calculate and output its 6th power (n * n * n * n * n * n).
• Write a C++ code segment to read 20 non zero integer values and to count the number of positive values and the number of negative values, and to output the results.
• Write a C++ code segment to read 20 non zero integer values and to compute the average of positive values and the average of negative values, and to output the results.
• The Fibonacci sequence is the sequence: 1, 1, 2, 3, 5, 8, ..., such that the first and the second values are 1, and the value in any poisition n >= 3 is the sum of the two previous positions: the value in poisition 3 is the sum of the values in positions 2 and 1; the value in position 4 is the sum of the values in the two previous positions from the current position, and a variable new to hold the value of the current position, Write a C++ code segment to read an integer value greater than or equal to 3, and to output the Fibonacci sequence from position 3 to the position that corresponds to the value read. For example, if the input value is 8, the output will be: 2, 3, 5,8, 12, 21.
• A positive value is a prime number if it is divisible only by 1 and itself. Write a C++ code segment to read a positive integer value greater than 2 and to output a message indiciating whether it is a prime number or not. To find out whether a positive integer value n greater than 2 is a prime number, you may repeatedly divide it by i=2, then 3, then 4, ..., until the remainder is 0 or i * i >= n. The given value is a prime number if ithe remainder is not 0; otherwise; it is not a prime number.
• Write a C++ code to read an integer value greater than 1 and to compute its greatest divisor that is less than the value itself. For example, if the value is 15, the answer is 5, and if the value is 13, the answer is 1. You compute the greatest divisor of an integer value n greater than 1 that is less than n, by repeated dividing the value n by i = 2, then 3, then 4, ... etc., until you get a remainder of 0 or i * i >= n. If the remainder is 0, then the greatest divisor is n/i, otherwise, it is 1.
• Write a C++ code segment to read the prices of one or more books, and to compute their average price. Book prices are input one after another, and terminated with the sentinel value -99.
• Write a C++ code segment to read one or more positive integer values and to compute their product. The sentinal value 0 marks the end of the input values.
• Write a c++ code segment to read 50 integer values and do determine the number of even values (among these integer values) and print it.
• Write a c++ code segment to read one ore more integer values and to compute the average of positive values and print it. If there are no positive values, print an appropriate message.
• Write a C++ code segment to read an integer value, followed by an operator (+, -, *, %, or /), and then another integer value (for example, 23 + 5), and to compute the expression consisting of the first value, followed by the operator, which is followed by the second value, and to output the result. Note that in the division of the first value by second, you must make sure that the second value is not zero.
• Write a program segment to read a character from the keyboard and to determine if it is a letter ('a' - 'z' or 'A' - 'Z'), as digit ('0' - '9'), or a special character(any other character). If it is a letter, print the message "letter"; if it is a digit, pring the message "digit"l and if it is a special character, print the message "special character".