1. Write a for loop that prints the sum of all positive even integers less than 200. Assume that variables i and sum are already declared.
2. Write a while loop that prints the sum of all positive odd integers less than 100. Assume that variables i and sum are already declared.
3. Write a do-while loop that prints the sum of all positive multiples of 3 less than or equal to 150. Assume that variables i and sum are already declared.
for (i = 0; i < 200; i += 2) {
sum += i;
}
printf("%d\n", sum);
i = 1;
while (i < 100) {
sum += i;
i += 2;
}
printf("%d\n", sum);
i = 0;
do {
sum += i;
i += 3;
} while (i <= 150);
printf("%d\n", sum);1. Write a for loop that prints the sum of all positive even integers less than...
C++ Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out the sum of all the even integers read and the sum of all the odd integers read(The two sums are separated by a space). Declare any variables that are needed.
Please use Python to solve this problem: Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. After the loop terminates, it prints out, on a single line and separated by a single space, the sum of all the even integers read and the sum of all the odd integers read.
Write a for loop that prints in ascending order all the positive multiples of 5 that are less than 175, separated by spaces. PLEASE ANSWER IN C
Python 3.7.4: Write a for loop that prints, in ascending order, all the positive multiples of 5 that are less than 175. Each value must be on a separate line.
Write a while loop that prints all positive numbers that are divisible by 10 and less than a given number n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90. import java.util.Scanner; public class PositiveLess { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("n: "); int n = in.nextInt(); ... while (...) { ...
Python programming: Write a while loop that prints a. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81. b. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90 c. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16...
Write a program that reads a set of integers and then finds and prints the sum of the even and odd integers
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Write pseudocode while loop to sum all the values between 2 integers (A & B, input by the user), including A and B, and print the resulting sum. A must be less than B, otherwise print 0.
Write a for loop to add all the even numbers to sum, between 0 and 100 inclusive, that is, like 0 + 2 + 4 + 6 + ….. + 96 + 98 + 100. Use only two integer variables i and sum. Answer in java please