Write a function that displays the contents of an array in a predefined format with
the value of index 0, displayed last.
Write a function that reads real (fractional) numbers, 𝑥1, 𝑥2, … , 𝑥𝑁 from the keyboard
into an array of N, starting from index 0. The numbers are read after a prompt.
Write a function that reads real (fractional) numbers, 𝑥1, 𝑥2, … , 𝑥𝑁 from the keyboard
into an array of N, starting from index 0. The numbers are read after a prompt.
Write a program that reads a number and prints all of its binary digits: Print the remainder
number % 2, then replace the number with number / 2. Keep going until the number is 0. For
example, if the user provides the input 13, the output should be
1
1
1
Write a program with loops that compute the sum of all even digits of an input. (For
example, if the input is 32677, the sum would be 2 + 6 = 8.)
Sample Run
Enter integer: 32677
Sum of all even digits = 8
Write a program with loops that compute the sum of all odd numbers between a and b
(inclusive), where a and b are inputs.
Sample Run
Enter the lesser integer: 1
Enter the greater integer: 10
The sum of all odd numbers from 1 to 10 = 25
Write a program with loops that prints the square of each number from 20 up to 220.
Output Segment
Square of 20 = 400
Square of 21 = 441
Square of 22 = 484
Square of 23 = 529
Square of 24 = 576
:
:
Square of 220 = 48400
Write a program with loops that compute the sum of all squares between 1 and 100
(inclusive).
Output
Sum of all squares from 1 to 100 (inclusive) = 338350
Write programs with loops that compute the sum of all even numbers between 2 and 100
(inclusive).
Output
Sum of all even numbers from 2 - 100 = 2550