In problem 6 please make sure that you write print statements on a single line.
Solution for Problem 4:
count=0
for i in range(150,1001):
if i%2==1:
count=count+1
print('Number of odd numbers are',count)
sum=0
for i in range(150,1001):
if i%2==1:
sum=sum+i
print('Sum of odd numbers is',sum)
mul=1
for i in range(150,1001):
if i%2==1:
mul=mul*i
print('Multiplication of odd numbers is',mul)
square_sum=0
for i in range(150,1001):
if i%2==1:
square_sum=square_sum+i*i
print('Sum of squares of odd numbers is',square_sum)
Solution for Problem 5:
M=int(input("Enter value of M:"))
k=1
s=0
while k<M:
s=s+1/k
k=k+1
print('Answer is',s)
Solution for 6:
descriptor=''
magnitude=float(input('Enter magnitude of the earthquake:'))
if magnitude<2.0:
descriptor='Micro'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<3.0:
descriptor='Very minor'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<4.0:
descriptor='Minor'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<5.0:
descriptor='Light'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<6.0:
descriptor='Moderate'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<7.0:
descriptor='Strong'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<8.0:
descriptor='Major'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude<10.0:
descriptor='Great'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
elif magnitude>=10.0:
descriptor='Meteoric'
print('magnitude',magnitude,'earthquake is considered to be a ',descriptor,' earthquake')
Output for 4:
Output for 5:
Output for
6:

USE PYTHON: 4) [30pts] Write program which finds the followings for the given values between 150...
The following table contains on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0 Micro 2.0 to less than 3.0 Very minor 3.0 to less than 4.0 Minor 4.0 to less than 5.0 Light 5.0 to less than 6.0 Moderate 6.0 to less than 7.0 Strong 7.0 to less than 8.0 Major 8.0 to less than 10.0 Great 10.0 or more Meteoric Write a C program that reads a magnitude from the user and displays the appropriate descriptor...
Question 4-6 Please.
Python 3.6. def main().
entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...
Use a java program that does the following:
. (10 points) Write a program as follows a. Prompt the user to input two positive integers: nl and n2 (nl should be less than n2) b. If the user enters the negative number(s), convert it/them to positive number(s) c. If nl is greater than n2, swap them. d. Use a while loop to output all the even numbers between nl and n2 e. Use a while loop to output the sum...
Write a Python program to print all Perfect numbers between 1 to n. (Use any loop you want) Perfect number is a positive integer which is equal to the sum of its proper positive divisors. Proper divisors of 6 are 1, 2, 3. Sum of its proper divisors = 1 + 2 + 3 = 6. Hence 6 is a perfect number. *** proper divisor means the remainder will be 0 when divided by that number. Sample Input: n =...
Please answer in Visual Studio 2019 c# format. Not
python. Thank you.
Q. Write a program that works as described in the following scenario: The user enters a credit card number. The program displays whether the credit card number is valid or invalid. Here are two sample runs: Enter a credit card number as a long integer: 4388576018410707 4388576018410707 is valid Enter a credit card number as a long integer: 4388576018402626 4388576018402626 is invalid To check the validity of the...
Validating Credit Card Numbers Write a program named Creditcard.java that prompts the user for a credit card number and determines whether it is valid or not. (Much of this assignment is taken from exercise 6.31 in the book) Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits, and must start with: 4 for Visa cards 5 for Master cards 6 for Discover cards 37 for American Express cards The algorithm for determining...
write a Matlab program ( solve the three questions). please use array and create your own function to check primality Question 1 : [10 points) Write a MATLAB program that will store all the first 1000 prime numbers in an array variable named arr_of_primes. Please note that a prime number is a positive integer that is bigger than or equal to 2 which is divisible only by 1 and itself. Examples of the first 8 primes are: 2, 3, 5,...
write a java program that does the following Part one Use a For loop to compute the sum of all the odd numbers from 1 through 99. Your result should be labeled, and the value should be 2500. Print your name 7 times using a While loop. String dogNames[ ] = {"Sam","Buster","Fido","Patches","Gromit","Flicka"}; Using the array defined here, print the values of the array vertically and horizontally using one For-Each loop. Reverse the logic (Nested loops: Indent text) so that the...
This interactive program focuses on if/else statements, Scanner, and returning values. Turn in a file named Budgeter.java. To use a Scanner for console input, you must import java.util.*; in your code. This program prompts a person for income and expense amounts, then calculates their net monthly income. Below are two example logs of execution from the program. This program’s behavior is dependent on the user input (user input is bold and underlined below to make it stand out and differentiate...
Predatory Pricing Which of the followings is not the purpose of predatory pricing? A To drive competitors out of a market B To prevent entry by potential rivals C To increase its own market power O D to increase output and lower prices Economies and Diseconomies of Scale When a firm gets so large that coordination and management of workers and other inputs becomes costly and difficult, it is experiencing which of the following? O A Diseconomies of scale O...