Problem 1 (10 points) Write a complete program that asks the user to enter an integer n. If the value of n is greater than or equal to 10 and less than or equal to 99 the program should print a line of n stars. Otherwise it should say Hello. Here is a sample to show how the program runs. Enter the value of n: 17 *****************
Q: Q1) Write a program that Asks for a natural number (Assume that number is n) Draws the following…
A: As programming language is not mentioned, so we are providing answer in C++ language.
Q: Practice 2: 20 minutes Write a program that prompts the user to enter a positive integer ranging…
A: The code C++ for given problem.
Q: Q1/ Write a Program to compute the area of triangle with design.
A: Since programming language is not mentioned I have used the C++ programming language. Requirement:…
Q: Part G: Track Meet Write a program that asks the user to enter the names and times (in seconds) for…
A: Solution: Let understand the solution by algorithm. Algorithm: 1) Create an empty dictionary to…
Q: Problem 2: Multiple stages There are only two rest days in the Tour de France. You will now write…
A: Since the Programming language is not mentioned in the question, we will answer this question in C++…
Q: The area of a rectangle is the rectangle’s length times its width. Write a program that asks for the…
A: Note - Since you have not provided the language to write the code so I am using java language to…
Q: Program2: function Write a program that prompt the user to enter two positive integer numbers x and…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //get…
Q: 1. Given two numbers X and Y. Write a program to determine the difference between X and Y. If X - Y…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: c++ Given two sequences with n integers between 0 and 9, interpreted as two n-digit integers,…
A:
Q: Assignment 3: Write a program to calculate the following: B=£x*
A: Algorithm/Steps: Ask the user to the input the value of n Store sum in variable B calculate the sum…
Q: C++ Demonstration #2: Write a program segment that will asks for a grade from the user. Display ‘A’…
A: * Program Explanation :- First create variable for marks and give name ms. Take the value form the…
Q: Python Coding- Except ValueError Using Except ValueError, change the program so that if the user…
A: The modified python code and approach are given below: - Approach: - Importing the essential…
Q: Q1/ Write a program to enter a value of x and compute the value of y (xif x > 0 (-x if x < 0 Where y…
A: Define variable x and y for user input x ← Take user input if x>=0 y ← x else y ← -x…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: #include<stdio.h> int main(){ char category; //variable to store oil category int miles;…
Q: Q4) Write program, to allow the user to enter the height, and width of any rectangle, and find the…
A: I have answered the question in step 2.
Q: please help me solve this problem the language is C++
A: Program Instructions:Ask the user the name of each friend one by one.Calculate the 20% tip, total…
Q: Is there a way to condense my statements? I'm also getting a "bad operand type" error. I haven't…
A: The error you were getting was due to improper arguments in the print statements. The rectified Java…
Q: Problem #3: Write a program that prompts the user to enter two integers m and n and displays the…
A: C++ Program for above : #include <iostream> using namespace std; int main() { while…
Q: FLOWCHART with looping Problem 3. Write a program that will display an n x n box of asterisks,…
A: Flowchart: Program: The program is in C++ programming language: #include <iostream> using…
Q: Q5: - Write program to calculate the equation sin(x) y(x) = x* where x 0.1, 0.2,0.3,0.4 Use a combo…
A: Problem Analysis : Note: Since programming language is not mentioned therefore answering the…
Q: Part-B: Problem Description: Consider a four digit number corresponding to number of letters in…
A: Java is a programming language originally developed by James Gosling at Sun Microsystems (which is…
Q: 5.17 LAB: Countdown until matching digits Write a program that takes in an integer in the range…
A: Given: To write a code.
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: Note: As per our guidelines we are supposed to answer only one question so post then next problem as…
Q: Q3] (1 Write a program to enter a value of x and compute the value of y where x if x 20 -x if x<0 y=
A: x=int(input("Enter x value: "))if x>=0: y=xelse: y=-xprint("The value of y is: ",y)…
Q: Write a Program to find all Roots of a Quadratic Equation
A: a,b, c are coefficients where x can be calculayed by: x = [-b +- (b^2 - 4ac)^1/2] /2a D = b^2-4ac is…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: PROGRAM CODE: import java.util.*; // import utility package of javapublic class…
Q: Problem 1. Write a program to calculate the real roots of the quadratic equation. Note: use…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: 9. Write a program which asks the user for their score on the exam. Display their letter grade based…
A: Ans: Code: grad = input('Grad> ') if grad >= 90 fprintf('A'); elseif grad >= 80…
Q: Exercise 6: Write a program that asks the user to enter number and read it. Then display the content…
A: As the programming language is not mentioned so I am writing a code in C++ language. If you want a…
Q: Q2] write a program calculates the value of( Q)from the following series x3 Q= 1+7 x+ + + ... 3! 4!…
A: #include <math.h>#include <stdio.h> double sum(int x, int n){ double i, total = 1.0;…
Q: Q3] ( Write a program to enter a value of x and compute the value of y where x if x ≥ 0 -x if x<0 y
A: In mathematics function is the expression or rule or law which defines the relationship between the…
Q: program that will print countdown from 10 to 1 and will print HAPPY NEW YEAR after
A: Please find the answer below :
Q: B) write program in Visual Basic to solve the equation. Z (X+Y) According to the Following required.…
A: B) write program in Visual Basic to solve the equation. Z= (X+Y) According to the Following…
Q: C++ Write a program to check a number is prime or not. The number must be taken. From user
A: Requirements :- C++ Write a program to check a number is prime or not. The number must be taken.…
Q: 2. The coordinates of two two-dimensional points P 1 (x 1 ,y 1) and P 2 (x 2 ,y 2) are input through…
A: A line is passed through the points P1(x1, y1) and P2(x2, y2) then equation of that line is, y - y1x…
Q: C++ OOP Write a program that prompts the user to input a length expressed in centimeters. The…
A: Program plan: Prompt for the centimeter value Converts the centimeter length to inch lengthInch…
Q: Problem #1: [35 pts] Write a program to calculate the estimated engine horsepower of a car based on…
A: Ans: Code: import java.util.*;import java.lang.Math; public class Main{ public static void…
Q: Problem 1: Woodchucks Concatenation Problem Please write a program that prints the woodchuck tongue…
A: SO, here below is the solution code for your given problem: - #include <iostream>…
Q: PROBLEM 23 – 0560: Write a Basic program to solve the following puzzle: A and B are the players. A…
A: The game is centered on the notion of congruence. Let x be the unknown number chosen by B, 1 ≤ x ≤…
Q: [Problem description] Write a program that reads an unspecified number of integer s, and print the…
A: Hello student Greetings Hope you are doing great. Thank You!!!
Q: Q1\Write a program that sums the numbers between 1 and 9 and finds the sum total
A: Here language is not mentioned so i write c code to sum between 1 to 9: (2+3+4+5+6+7+8)…
Q: (Diameter, Circumference and Area of a Circle) Write a program that reads in the radiusof a circle…
A: #include <stdio.h> int main() { float r; printf("enter radius :- "); scanf("%f",&r);…
Q: Problem - 1: Write a program that asks the user to enter a minute value. The main() function should…
A: 1) Since you have not specified programming language I have written program in C language 2) Below…
Q: (c) You are required to create a program that reads a letter of the alphabet from the user. If the…
A: We want to check if the letter input is vowel or not, for y we have added a check, and printed…
Q: C++ Exercise 30 defines the number e and Exercise 31 shows how to approximate the value of e using…
A: #include <iostream> using namespace std; float cal(int i, int n) { if(i == n) return ((i-1) +…
Q: LAB: Count characters - methods Write a program whose input is a character and a string, and whose…
A: import java.util.*; public class Main { public static int countCharacters(char userChar, String…
Q: 2)If a five-digit number is input through the keyboard, write a program to print a new number by…
A: Below is the C++ code. Approach of Program: Include a necessary header files and use a namespace to…
Q: Program #1 15 points Write a C++ program that determines a student's grade. The program will read…
A: Code #include<iostream>#include<conio.h>#include<string.h>using namespace std;void…
C++
Step by step
Solved in 3 steps with 2 images
- C program: The user should enter a number and then the next consecutive numbers are printed in. How would I approach this?Problem 3: COMPUTER FUNDAMENTALS AND PROGRAMMING 2In a triangle, the sum of the 1st and 2nd side must always be greater than the 3rd side. Create a program that will input 3 positive integers representing the 3 sides of the triangle and determine whether they form a valid triangle. If they do, compute, and print the perimeter of the triangle, otherwise, display the message, invalid triangle. Perimeter = 1st side + 2bd side + 3rd sideC Program In order to discourage excess electric consumption, an electrical company charges its customers a lower rate of P75 for the first 250 kilowatt-hours and a higher rate of P8.5 for each additional kilowatt-hour. In addition, a 10% surtax is added to the final bill. Write a program that calculates the electrical bill given the number of kilowatt-hours consumed as input. At the end, print the number of kilowatt-hours consumed and the computed bill.
- Problem 3 Rolling Two Dice Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums.] Figure 6.24 shows the 36 possible combinations of the two dice. Your program should roll the two dice 36,000 times. Use a one-dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7.python code Problem 5 A nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consumed in a day. Then, she calculates the number of calories that result from the fat, using the following formula: calories from fat = fat grams x 9. Next, she calculates the number of calories that result from the carbohydrates, using the following formula: calories from carbs = carb grams x 4 . Write a program that will make these calculations. Your program should use two separate functions to calculate fat and carb calories. Write a 3rd function that is called from main to capture user input and call the others.PROBLEM 21. [TIME ALLOWED = 5 MINUTES] This is about the truth value of the statement: “There exist positive integers x, y, and z such that x3 + y3 = z2.” Select one of the following: (a) x = 1, y = 2, z = 3. (b) x = 2, y = 2, z = 4. (c) x = 3, y = 4, z = 5. (d) (a), but not (b). (e) Both (a) and (b), but not (c).
- Problem 3 Rolling Two Dice (in c language) Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums.] Figure 6.24 shows the 36 possible combinations of the two dice. Your program should roll the two dice 36,000 times. Use a one-dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7.1.Write a program to determine whether a number is a deficient number or not. A number is deficient number as the sum of its factors (1+3+5+15=24) is less than 30 (double of 15). On the other hand, 24 is not a deficient number. Because the sum of the factors of 24 (1,2,3,4,6,8,12,24) is 60 which is larger than double of 24. 2.Manually trace(show the values of all the variables in each step) the following code segment. int n=5,sum=0,i,a=3,sign=1; for(i=1;iProblem 2: Multiple stages There are only two rest days in the Tour de France. You will now write a program to calculate the remaining distance before the rest day after each stage. Riders will rest after they finish the fifth stage.Your program will read five distances AS INTEGERS, one for each stage in order. After, you will read the total time of all five days. You will then print how many kilometres are left after each stage and the rider's average speed (in km/h) after all inputed stages, according to the example below.InputYou will read from the use the following (in order):• 5 distances one of each stage• The rider's total time across all stagesOutputEnd of first stage, {distance}km left until rest dayEnd of second stage, {distance}km left until rest dayEnd of third stage, {distance}km left until rest dayEnd of fourth stage, {distance}km left until rest day--REST--Average speed across the five days: {speed} km/hExample:Input Output…
- 1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some Fibonacci numbers are 1, 1, 2, 3, 5, 8, ... where the next number is found by summing the preceding two numbers. Your program will read in a number, like 7, report the first 7 numbers. in this case1,1,2,3,5,8,13. Your program is not assured of receiving good data, thus if -2 is received as the number of numbers, then an error should be reported.Problem Description The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers. Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well. Input A line containing two integers separated by a space. 6·9 Output A line containing an integer. 31)(Calculating Credit Limits) Collecting money becomes increasingly difficult during periods of recession, so companies may tighten their credit limits to prevent their accounts receivable (money owed to them) from becoming too large. In response to a prolonged recession, one company has cut its customers’ credit limits in half. Thus, if a particular customer had a credit limit of $2000, it’s now $1000. If a customer had a credit limit of $5000, it’s now $2500. Write a program that analyzes the credit status of three customers of this company. For each customer you’re given: a) The customer’s account number. b) The customer’s credit limit before the recession. c) The customer’s current balance (i.e., the amount the customer owes the company). Your program should calculate and print the new credit limit for each customer and should determine (and print) which customers have current balances that exceed their new credit limits. 2) (Coin Tossing) Write a program that simulates coin…