Question: ) Write a program as follows: It shoud be used Java language) Prompt the user to input two positive integers: n1 and n2 (n1 should
) Write a program as follows: It shoud be used Java language)
Prompt the user to input two positive integers: n1 and n2 (n1 should be less than n2).
If the user enters the negative number(s), convert it/them to positive number(s).
If n1 is greater than n2, swap them.
Use a while loop to output all the even numbers between n1 and n2.
Use a while loop to output the sum of all the odd numbers between n1 and n2.
Use a while loop to output the sum of squares of all the odd numbers between n1 and n2.
Use a while loop to output all the lower case letters.
Sample run:
| Enter two numbers (First number must be less than the second number) Enter the first number: -21 Enter the second number: 5 Even integers between 5 and 21 are: 6 8 10 12 14 16 18 20 Sum of odd integers between 5 and 21 = 117 Sum of the squares of odd integers between 5 and 21 = 1761 Lower case letters are: a b c d e f g h i j k l m n o p q r s t u v w x y z |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
