Write a program that prompts the user to enter a nonnegative integer and outputs the factorial of the number.
Q: Write a program that reads two pieces of information: the hourly wages and the number of hours…
A: step 1: ask for employee hourly wages step 2: ask for the number of hours worked step 3: calculate…
Q: Write a program that prompts the user to enter an integer and prints the value of the following…
A: Below I have provided the Java code of the given Question. Also, I have attached the output of the…
Q: Write a program that computes the molecular weight of a carbohydrate (ingrams per mole) based on the…
A: Given: Write a program that computes the molecular weight of a carbohydrate (ingrams per mole) based…
Q: Write a program that does the following: 1. prompts the user to enter a word 2. using that word,…
A: To Do: To write the C++ Code.
Q: 4. Before you can cross a bridge with your car, it must weigh within +/- 100 pounds of 1 ton For…
A: Hey, since multiple questions posted, we will answer first question according to our policy. If you…
Q: In Python programming language. Write a program that calculates the sum of prime numbers that could…
A: def prime_number(n): #function prime_number if(n == 0 or n == 1): #if n is 0 or…
Q: Write a program that prompts the user to enter two integer numbers x and y. The program must check…
A: Since , their is no any specific language is mentioned for writing a program so program is written…
Q: Write a program that reads two pieces of information: the hourly wages and the number of hours…
A: Required: Write a python program to calculate the net salary based on given instructions. all the…
Q: Write a program that determines a student grade's given his/her final score. Use the following table…
A: According to the Question below the Solution: Output:
Q: Write a temperature-conversion program that gives the user the option of converting Fahrenheit to…
A: The program is written in python def CtoF(): celsius = float(input("Enter temperature in…
Q: A county collects property taxes on the assessed value of property, which is 60 percent of its…
A: Step 1: Prompt and accept property value from the user. Step 2: Prompt and accept tax rate per $100…
Q: Write a program that asks the user to enter a number of seconds. Solving the Time Calculator Problem…
A: sec=int(input("Enter number of seconds: ")) if sec<3600 and sec>=60 : print(f"Number of…
Q: Write a program that calculates the potential energy of 3 charges q1 = 1, q2 = 2, q3 = 3 located at…
A: For the given points (1, 2, 3), (3, -4, -5) and (-4, 2, -6) The rij is the distance between charges…
Q: Write a program that reads the income of a user and computes his/her income taxes according to the…
A: 1:Read the income 2:If income is negative then print error and exit 3:Determin the tax slab as per…
Q: Given an a dollar amount Write a program to convert it into Maximum number of bills to give * 100s,…
A: Source Code dollar.cpp #include<bits/stdc++.h> using namespace std; int main(){ int…
Q: Write a program that calculates the factorial of a number N, where N is requested from the user.
A: Check the code below.
Q: Write a program that prompts the user to enter two integer values and prints all numbers between the…
A: The Java code along with the snapshot of code and output is given below:
Q: Write a program that prompts the user to enter a nonnegative integer and outputs the factorial of…
A: #include<iostream> using namespace std; int main(){ int number; cout << "Enter a…
Q: In this exercise you will create a program that reads a letter of the alphabet from the user. If the…
A: In this program Get the input alphabetical letter from the user Using if statement check the entered…
Q: Suppose that the first number of a sequence is x, where x is a non-zero positive integer. We define…
A: Program in C++ to print sequence of number for the case defined in the statement above
Q: Write a program that computes the equivalent resistance of a purely series and purely parallel…
A: Given: Write a program that computes the equivalent resistance of a purely series and purely…
Q: Write a program that finds and displays all the "odd numbers" between 1 and N. The value of N is an…
A: Algorithm: 1. Start. 2. Initialize sum to 0 and declare n. 3. Read the positive integer as n. 4.…
Q: Write a program that does the following: 1. prompts the user to enter a word 2. using that word,…
A: Code: Output:
Q: Write a program that prompts the user to enterthe month and year and displays the number of days in…
A: Program: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Write a program that prompts the user to enter an integer and prints the value of the following…
A: Below I have provided Java Programming. Also, I have attached the screenshot of the code and output…
Q: Write a program that computes the fuel efficiency for a multi-leg journey. The program will first…
A: Code To Copy: #Define the main() function. def main(): #Prompt the user to enter the…
Q: Write a program that prompts the user to input three numbers. The program should then output the…
A: The given is the requirement to solve the problem in C++ programming lanague where: a) User will…
Q: Write a program that asks the user for three numbers and print the numbers in either ascending or…
A: n1 = float(input("Enter number a: "))n2 = float(input("Enter number b: "))n3 = float(input("Enter…
Q: Suppose that the first number of a sequence is x, where x is a non-zero positive integer. We define…
A: #include <iostream>using namespace std; int main(){ char hims; do{ cout…
Q: In Python Write a program that computes the fuel efficiency for a multi-leg journey. The program…
A: def main(): #Prompt the user to enter the input. start_odo = float(input("Enter the initial…
Q: Write a program that finds the negative integer solutions of the following equation ax³ + bx² + cx'…
A: The objective of the given problem is to find the negative integer solution in the range of -200 to…
Q: Write a program that accepts the names of three political parties and the number of votes each…
A: Actually, program is a executable software that runs on a computer.
Q: WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. CALCULATE THE…
A: Hey, thank you for your question. There are multiple subparts submitted to your question. As per our…
Q: Write a program that prompts the user to enter the currency exchange rate between U.S. dollars and…
A: GIVEN: Write a program that prompts the user to enter the currency exchange rate between U.S.…
Q: Write a program that computes the fuel efficiency of a multi-leg journey. The program will first…
A: Python code :- def question9(): print("Question 9) # arrays to store miles and gas used…
Q: I have a calculator program that needs to prompt the user to try again if he does not do what the…
A: In the given program code, You are trying to use fail() method, this method is used to check that…
Q: In C++ language, create a program that gets quarterly sales from a user, and calculates the total of…
A: - We need to code for the sales program.
Q: Write a program that prompts the user to enter an integer (n) and a sum value (s). The program…
A: Algorithm: Step1: Declare variable n. Step2: Declare variable to store sum value, difference value…
Q: Write a program that computes the fuel efficiency of a multi-leg journey. The program will first…
A: We need to write a Python program for given scenario.
Q: Write a program that reads a positive integer x from the user. If x is even, the program prints all…
A: logic:- declare x do { read positive number if x<0 display error message } while (x<0); if…
Q: In Python programming language. Write a program that calculates the sum of prime numbers that could…
A: Step 1: Read bStep 2: While (temp=true):Step 3: if b is positive Call sum().…
Q: Write a program that does the following: 1. prompts the user to enter a word 2. using that word,…
A: Here I have taken input from the user and stored it into a variable of type string. Next, I have…
Q: Write a program that prompts the user to enter the year and first day of the year, then displays the…
A: Given, we get- year from the user, first day of the year from user. based on the above data, we…
Q: PYTHON write a program that assigns the principal amount of P10000 to variable P, assign to n the…
A: We are going to write a PYTHON code which will find out the total amount which will be compounded…
Q: Write a program that accepts a number and determines whether the number is positive, negative or a…
A: Given: To write a C code.
Q: In an eye-glass shop, a customer can buy either a pair of single prescription glasses (or a pair of…
A: Code: import java.util.*;public class MyClass { public static void main(String args[]) {…
Q: The ancient Greeks classified numbers geometrically. For example, a number was called "triangular"…
A: Sample Response: // C++ program to check whether a number is a triangular number or not by using…
Q: In Python, A sales event at Trader Jane's is reducing some items by 25%. Store that value to a…
A: Program Planning Prompt the user for giving input on the ticket price of the item. Store the input…
Q: Write a program that prompts the user to enter two integer numbers x and y. The program must check…
A: The complete JAVA code is given below with code and output screenshots
Q: Write a program that prompts the user to enter two integer numbers A and B. The program must check…
A: Using if else and for loops we can solve this problem.
Instructions
Let n be a nonnegative integer. The factorial of n, written n!, is defined by 0! = 1, n! = 1·2·3· · ·n if n ≥ 1. For example, 4! = 1·2·3·4 = 24.
Write a program that prompts the user to enter a nonnegative integer and outputs the factorial of the number.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a wedding or conference, the hotel offers a special discount as follows: If the number of rooms booked at least 10, the discount is 10%; at least 20, the discount is 20%; and at least 30, the discount is 30%. Also if rooms are booked for at least three days, then there is an additional 5% discount. Write a program that prompts the user to enter the cost of renting one room, the number of rooms booked, the number of days the rooms are booked, and the sales tax (as a percent). The program outputs the cost of renting one room, the discount on each room as a percent, the number of rooms booked, the number of days the rooms are booked, the total cost of the rooms, the sales tax, and the total billing amount. Your program must use appropriate named constants to store special values such as various discounts.a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation using the following wording: You ordered 27 eggs. That’s 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85. So far everything is right but something in my equations is causing my ouput to show up as 45.0
- Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation using the following wording: You ordered 27 eggs. That’s 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85.Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen eggs, or 45 cents for individual eggs that are not part of a dozen. Write a program that prompts a user for the number of eggs in the order and then display the amount owed with a full explanation using the following wording: You ordered 27 eggs. That’s 2 dozen at $3.25 per dozen and 3 loose eggs at 45 cents each for a total of $7.85. write a program that calculates the following: The program calculates the cost of 12 egss The program calculates the cost of 35 eggs The program calculates the cost of 6 eggs JAVA import java.util.Scanner; class Eggs { public static void main(String[] args) { // Write your code here } }Fox International sells pre-paid calling card with the following features: Calls to USo 1.2 cents per minute plus a 49 cent connection fee per call Calls to Europeo 2.3 cents per minute plus a 49 cent connection fee per call Calls to Australiao 6.4 cents per minutes plus a 49 cent connection fee per callWrite a program that work out the charges for the month. The program should accept the followinginformation: Account holders name Card number Starting Balance on card For US callso Total number of minutes of all callso Total number of calls made For European callso Total number of minutes of all callso Total number of calls made For Australian callso Total number of minutes of all callso Total number of calls madeYou are NOT expected to error check your inputs for this assignment. (e.g. checking for negative values,etc.). There is NO GST charged on the calls as the GST was paid when the card was purchased.Format of output:Review the test plan to see how the user would like the…
- Airline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönderWrite a program that computes the molecular weight of a carbohydrate (ingrams per mole) based on the number of hydrogen, carbon, and oxygenatoms in the molecule. The program should prompt the user to enter thenumber of hydrogen atoms, the number of carbon atoms, and the numberof oxygen atoms. The program then prints the total combined molecularweight of all the atoms based on these individual atom weights:Atom Weight(grams I mole)H 1.00794c 12.01070 15.9994For example, the molecular weight of water (H20) is: 2(1.00794) +15.9994 = 18.01528.arning Portal Courses Reports e-Services Academic Departments ETC CIMS Write a python program to accept a number and if the number is even calculate Z-y modulus x, by taking x and y input from user If number is positive.calculate Z-y to the powerx, by taking x and y input from user if the number s equal to 0 caculate Z-x to thne powery by tking xand y input from user fnumber is in tetween 1and 10 cakulate 7**y2.by taking and y input from user Otherwise display Invalid input:
- Write a program that calculates the factorial of a number N, where N is requested from the user.The factorial of a number is: If N=0 or N=1, the factorial is 1If N is any positive number it is calculated asN! = 1 * 2 * 3 * ... * N. For example, factorial of 4 is 1 * 2 * 3 * 4 = 24 If the user enters a negative value, the following message should be displayed:"Undefined factor for negatives"2. Write an if...else statement that determines whether a variable called points is outside the range of 9 to 51 (exclusive). If the variable is outside this range it should display "Invalid points". Otherwise, it should display “Valid points". 3. Write an if...else statement that determines whether a variable called speed is inside the range of 0 to 200 (inclusive). If the variable is inside this range it should display "Valid Speed". Otherwise, it should display "Invalid Speed".The first 11 prime integers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31. A positive integer between 1 and 1000 (inclusive), other than the first 11 prime integers, is prime if it is not divisible by 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and 31. Write a program that: Prompts the user to enter a positive integer between 1 and 1000 (inclusive) Outputs whether the number is prime. If the number is not prime, then output all the numbers, from the list of the first 11 prime integers, which divide the number. In C also the output should look like this Enter an integer between 1 and 1000 (inclusive): 6262 is divisible by 2, 31.62 is not prime. ---------------------------------------------------- Enter an integer between 1 and 1000 (inclusive): -1You must enter a number between 1 and 1000 (inclusive). ---------------------------------------------------- Enter an integer between 1 and 1000 (inclusive): 33 is prime.