============================= PART - A =================
Screenshots of Code :

Screenshots of Output :


Code to copy:
'''<<<<<<-------PART -A------->>>>>'''
# taking input for first time
num = int(input("Enter a positive number: "))
# while loop for input validation
while num <= 0:
print("wrong input, try again")
num = int(input("Enter a positive number: "))
# sum varaible to store sum
total = 0
# variable to control loop
i = 1
#loop to calculate sum
while i<=num:
total = total + i
i = i + 1
# printing sum
print("The sum from 1 to ",num, "is ",total)
=============================== PART-B ======================
Screenshots of Code :

Screenshots of Output :

Code to copy:
'''<<<<<<-------PART -B------->>>>>'''
# answer variable to store answer
answer = 'y'
# loop until answer is 'y'
while answer == 'y' or answer == 'Y':
# taking number input for first time
num = int(input("Enter a positive number: "))
# while loop for input validation
while num <= 0:
print("wrong input, try again")
num = int(input("Enter a positive number: "))
# sum varaible to store sum
total = 0
# variable to control loop
i = 1
# loop to calculate sum
while i <= num:
total = total + i
i = i + 1
# printing sum
print("The sum from 1 to ", num, "is ", total)
# taking input for whether want to enter another number
answer = input("Do you want to enter another number?(y/n): ")
=======================================================
Lab 5-2 Nested Loops 2. Summation Of Numbers (using Nested While Loops) Part A: The program...
5. Create a java application that uses nested loops to collect data and calculate the average rainfall over a peniod of years First the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month, the program should display the number of months, the total...
Please use python to write the simple program.
Exercise 2 - Summation Write a program to accept integer inputs until the user inputs a non-integer. Then, the program prints the summation of the inputted numbers. Hint: Use the function input() to get the user input. Use a variable total for calculating the summation. Need to use while loop for the repeated inputs. Use if statement with isdigit() function to check whether the user input is an integer or not. if...
In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read. Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. version1: use a while loop. version2: use a do-while loop. version 3: use a for loop. For each version, use a loop to input 10 int numbers from the user...
In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read. Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. The program must be in one file. version1: use a while loop. version2: use a do-while loop. version 3: use a for loop. For each version, use a loop to...
Task 5.2 Numerical Analysis Using Nested Loops (13 pts) Consider the following program: void setup() { //Read a positive integer from the user //Your code starts here } Complete this program such that it calculates all prime numbers between 1 and the value that is assigned to variable num and outputs them on the screen. A prime number is a positive integer that has no other factors other than itself and 1. You should use a nested loop, i.e., write...
Write them in python IDLE *****
5. Average Rainfall
Write a program that uses nested loops to collect data
and calculate the average rainfall over a period of years. The
program should first ask for the number of years. The outer loop
will iterate once for each year. The inner loop will iterate twelve
times, once for each month. Each iteration of the inner loop will
ask the user for the inches of rainfall for that month. After all
iterations,...
Solve Question using While loops-MATLAB Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number.
Create A MultiplicationTable program using nested for loops which will display a multiplication table for the hexadecimal numbers 1 - F. Nested for Hint: if you use the System.out.printf method with a format specifier "%X" it will display an integer value in hexadecimal format.
***** JAVA ONLY ***** Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. Frist the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the...
Using loops, write a C# program that asks the user to enter repeatedly an integer number, it stops when the user enters -1, then the program should display how many numbers were entered, their the sum and their average