Guessing Numbers---The problem is to guess what number a computer has in mind. You will write a program that randomly generates an integer between 0 and 100, inclusive. The program prompts the user to enter a number continuously until the number matches the randomly generated number. For each user input, the program tells the user whether the input is too low or too high, so the user can make the next guess intelligently. Here is a sample run. (do it using while or do-while loop only) Guess a magic number between 0 and 100 Enter your guess: 50 Your guess is too high Enter your guess: 25 Ener Your guess is too low Enter your guess: 42 reer Your guess is too high Enter your guess: 39 enter Yes, the number is 39 Diter
Q: 2- What is the output of the expression (N(2,end)) where N=[2 4 5;1 2 4;7 8 0].
A: Here, Code is given.
Q: Write pseudocode for a Python program that uses iteration to guess a number from 1 to 10 that…
A: - We need to highlight the pseudocode and the program and the code with output screenshot
Q: Statistics are often calculated with varying amounts of input data. Write a program that takes any…
A: Program: user_input = input() tokens = user_input.split() sum=0 # Initially sum is 0 maxNumber =…
Q: Re-write the Coin Toss code so that it is working correctly: The following program is meant to be a…
A: Since there are only 2 chances no need of while loop. So I removed the while loop You are checking…
Q: Using Python: Write a program which repeatedly reads numbers until the user enters “done”. Once…
A: The total will be used to give the sum of numbers entered, the count will give the number of values…
Q: Write a program that will read a number from the keyboard. If 60≤number≤100 , display “Pass”, if…
A: Conditional Statement in C: Conditional statements in C execute sequentially based on the some…
Q: C++ One way to create a pseudo-random three digit number (and we are including one- and two-digit…
A: Code: #include <iostream>#include <cstdlib>#include <ctime>using namespace std;…
Q: One of the downsides of using expressions that produce results other than true or false is it…
A: True false outcome expression are easy to use in conditional statements.
Q: User Prompts Your program will allow a human user to play Rock, Paper, Scissors with the computer.…
A: #Program import random def main(): print('ROCK'+'PAPER'+''+'SCISSORS'+''+'in Python') print()…
Q: Modify the guessing-game program so that the user thinks of a number that the computer must guess. •…
A: Below is the required python program: - Approach: - Import the essential packages. Prompts the user…
Q: "QUICK-BASIC64 Write an algorithm that finds and prints the sum of the first N terms of the series…
A: CLS A = 1 INPUT "ENTER NUMBER OF TIMES THE SERIES WILL RUN="; N FOR I = 1 TO N PRINT A; A = A +3…
Q: Write pseudocode for a Python program that uses iteration to guess a number from 1 to 10 that…
A: PSEUDOCODE: Following is the pseudocode for the required program code: start import random module…
Q: Write a program for pseudo- random where user input and obtain three different numbers.
A: Pseudo-Random Number- It is a number that is not really random, but seems to be random, i.e., each…
Q: In physics, an object that is in motion is said to have kinetic energy. The foll formula can be used…
A: - We need to highlight the code for the required calculation. - We are using C++ here.
Q: A word is called as a good word if all the letters of the word are distinct. That is, all the…
A: Actually, python is a easiest programming language. It has a concise(less) code.
Q: Print the Name of Program: "Can you say an even number?" Prompt the user for an input number If the…
A: Here no language is mentioned, so I have provided python code to perform the given question.
Q: In Python A soup company is interested in finding out how much of their soup will go into various…
A: def soup_volume(d, h): r = d / 2 volume = math.pi * pow(r, 2) * h volume = 0.95 * volume…
Q: In a parallel universe there are 8 days in a week. The 8th day is called Merday and it comes between…
A: Below I have provided the java code of the given question. Also, I have attached the code snippet…
Q: Guessing Numbers---The problem is to guess what number a computer has in mind. You will write a…
A: import java.util.Random;import java.util.Scanner; public class Main { public static void…
Q: Exercise 2: Write a java program that asks user to enter a set of positive integer values. When the…
A: code: //importing required packageimport java.util.Scanner;//main classpublic class Main{ //main…
Q: Write a program that displays a menu as shown in the sample run. You can enter 1, 2, 3, or 4 for…
A: #include <bits/stdc++.h>using namespace std; void menu(){cout << "Press 1 to calculate…
Q: Can someone help me answer this in Coral programming language? 1) The year must be divisible by 4…
A: Answer :
Q: Write pseudocode for a program that outputs every number from 1 through 15 along with its value…
A: To do: Write Pseudocode
Q: You are working on a ticketing system. A ticket costs $10. The office is running a discount…
A: Given: To write a C++ Code.
Q: Convert feet into meters: Write a program which reads the number in feet, converts it to meters, and…
A: Please find the answer below :
Q: Modify the guessing-game program so that the user thinks of a number that the computer must guess.…
A: The code given in the problem has no limitation on the number of guesses. As a result, until the…
Q: Using Python: Write a program which repeatedly reads numbers until the user enters “done”. Once…
A: Introduction Using Python: Write a program which repeatedly reads numbers until the user enters…
Q: A variable like user_num can store a value like an integer. Extend the given program as indicated.…
A: PYTHON CODE:- user_num = int(input('Enter integer:\n')) print ('You entered: ' + str(user_num))…
Q: Write a program that performs as a very simple calculator. Your calculator should be able to handle…
A: GIVEN: Write a program that performs as a very simple calculator that handles the four basic math…
Q: Write a program that prompts the user to enter an integer (n) and a sum value (s). The program…
A: PROGRAM CODE: import java.util.*; // import java utility packagepublic class…
Q: For this problem, you are going to design a game for the children to teach them about numbers. You…
A: Since no programming language is specified, I am using python. Algorithm: Start Read a number If…
Q: A palindrome is a word or a phrase that is the same when read both forward and backward. Examples…
A: Python program to check whether the given word is palindrome or not In a function, first, compare…
Q: 4. Sum of Everything by Jemar Jude Maranga Write a program that will repeatedly ask the user to…
A: Program is in step 2. In the program, as you said input should be in series and output is the sum of…
Q: Write a program that repeatedly reads an integer value from the keyboard until the user enters a…
A: Create an Array to hold the sample inputs {10,4,12}. Declare and initialize the required variables…
Q: People find it easier to read time in hours, minutes, and seconds rather than just seconds. Write a…
A: The number of seconds in an hour are 60 * 60 = 3600, the number of seconds in a minute are 60. These…
Q: Write a program that takes any number of non-negative integers as input, and outputs the average and…
A: The required Java code is given below: import java.util.Scanner;public class AverageMax{ public…
Q: Write a Python program that accepts a single integer value entered by the user. If the value entered…
A: n=int(input("Enter a number :\n") )if(n>=1): for i in range(0,n): for j in range(0,n):…
Q: 1- Write a python code that asks the user to input the x and y coordinated of the points p1, p2 and…
A: As per our company guidelines we are supposed to answer only three sub part. Kindly repost other…
Q: 4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice.…
A: Programming language is Visual Basic.NET Steps to create a visual basic.net project to perform the…
Q: Write the qbasic program that generates one random number from A, B, and writes its products on the…
A: Below is the required QBasic program: - Explanation: - Declaring the variables. Using the module…
Q: our relative, who goes to primary school and has just learned the multiplication table, asks you to…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it…
Q: Question 1: Write a python program that takes two numbers (Integer) as inputs from the user.…
A: One program is asked in python programming language. Program prints one pattern using two inputs,…
Q: Debugging Coin Toss The following program is meant to be a simple coin toss guessing game. The…
A: MODIFIED CODE : import random guess = ''while guess not in ('heads', 'tails'):print("Guess the coin…
Q: Complete the following program that collects an input word from the keyboard and finds if the word…
A: PROGRAM CODE: word = input("Enter a word: ") // take the word from the…
Q: A variable like user_num can store a value like an integer. Extend the given program as indicated.…
A: CODE:- # Take first number as input from the user user_num = int(input('Enter integer: ')) #…
Q: The goal of this program is to input one number consisting of five digits (in one word) from the…
A: import java.util.Scanner; class Digit { // 2. two private members private String digit;…
Q: John is a magician; he has three cups and one ball. John asks people to specify how many times the…
A: #asking user for input n=int(input("How many times do you want to swap cups? ")) #list to hold which…
Q: A variable like userNum can store a value like an integer. Extend the given program as indicated. 1.…
A: Given requirement, A variable like userNum can store a value like an integer. Extend the given…
Q: Instructions Write a program that asks the user for the height of a diamond and outputs an ASCII…
A: the c program is:
Q: One sub for "For Loop" and second one for "For Each Loop" and third one for Do-While loops.…
A: The complete answer in VB Programming Language is below:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Write a program that generates a random number in the range from 1 through 100 After generating the random number, the user is to guess the number. If the user’s guess is higher than the random number, the program should display “Too high, try again” If user’s guess is lower than the random number, the program should display “Too low, try again”. If the user guesses the number, the program should congratulate the user and then generate a NEW random number so the game can start over. Make the game menu driven with these options Main Menu ______________ 1)Play Game 2)Exit written in pythonWhen analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 30 50 10 70 65 the output is: 20 40 0 60 55 The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list. For coding simplicity, follow every output value by a space, including the last one. 272772.1571588In this program you will ask the user for 4 integers that represent two fractions. First ask for the numerator of the first and then the denominator. Then ask for the numerator and denominator of the second.Your program should add the two fractions and print out the result. For example, a sample program run might look like this Numerator One: 1Denominator One: 2Numerator Two: 2Denominator Two: 5The sum is 9/10 Remember, if you have two fractions you add them with: a c ad + bc __ + ___ = ______ b d bd public class AddFractions { public static void main(String[] args) { //Ask user for the 4 numbers and create necessary variables. //create your final numerator //create your final denominator
- Write a guessing game program: - The program has to first generate a random number in range 1 - 100 inclusive.- The user has to enter a guess- The program has to either print lower or higher (if the user guess is less than the answer, it should print higher, otherwise lower)- The program should end and print 'You got it!' when the user gets it right. example: generated random number: 78 ````50```` example: generated random number: 78 ````50```` ````higher```` ````75```` ````higher```` ````87```` ````lower```` ````81```` ````lower```` ````78```` ````You got it!````Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Ex: When the input is: 15 20 0 5 -1 the output is: 10 20 You can assume that at least one non-negative integer is input. This is the code I am using: import java.util.Scanner; public class LabProgram {public static void main(String[] args) {Scanner input = new Scanner(System.in);int[] a= new int[100];int i=0, sum=0;double avg, max=0;while(true){a[i]=input.nextInt();if(a[i]<0)break;elsesum=sum+a[i]; // sum the numbersi++;}avg=(double)sum/i; //compute averagefor(int j=0; j<i;j++)if(max<a[j])max=a[j];System.out.printf("%.2f %.2f\n", avg,max); // print result}} These are the outputs I am getting and I cannot figure out how to remove the decimal. Input 15 20 0 5 -1 Your output 10.00 20.00 Expected output 10 20 Input 2 2 2…A word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. This can be continued based on the user input is 'Y'.
- You will select one of the problems below and create a program that uses nested selections to solve the problem.Do not use Boolean operators Do not use java.util.Scanner; Write a program that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid. The input is valid if the sum of every pair of two edges is greater than the remaining edge.Here is the sample run: Enter three edges: 1,1,1 The perimeter is 3 Enter three edges 1,3,1 The input is invalid(Display Magic Numbers) Display the first N magic numbers, where N is a positive number that the user provides as input. Here, a magic number is a number whose sum of its digits eventually leads to 1. For example, 1234 is a magic number because 1 + 2 + 3 + 4 = 10 and 1 + 0 = 1, while 1235 is not (1 + 2 + 3 + 5 = 11 and 1 + 1 = 2). Write a program that prints out the first N magic numbers, seven on each line. Here is the sample output: You are required to use the following function prototype: bool isMagic(int value); // Returns true if value is a magic number The outline of this function will be as follows: Step 1: Calculate the sum of digits of value Step 2: Repeat Step 1 until we get a single digit Step 3: If the resulting sum is equal to 1 then it is a magic number, otherwise notOne interesting application of computers is drawing graphs and bar charts.Write a program that prompts the user to enter 5 integers, and then outputs abar chart consisting of asterisks. The number of asterisks in each line of thebar chart must be equal to the number the user entered. You may assume theuser will enter only positive integers or 0. C++ please.
- Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Ex: When the input is: 15 20 0 5 -1 the output is: 10 20 You can assume that at least one non-negative integer is input. import java.util.Scanner; public class LabProgram {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int numValue;int average;int max;int numValues;int numTotal;numTotal = 0;numValues = 0;max = 0;numValue = scnr.nextInt();while (numValue > 0){numTotal = numTotal + numValue;numValues = numValues + 1;numValue = scnr.nextInt();}average = numTotal / numValues;System.out.print(average);while (numValues > max){max = numValues;System.out.print(" " + max);} }} Why is it giving me the wrong output??Convert feet into meters: Write a program which reads the number in feet, converts it tometers, and displays the result. One foot is 0.305 meters. One foot is 12 inches.Sample RunEnter the number of feet16.516.5 feet is 5.0325 meters16.5 feet is 198.0 inchesA python program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’t display the computer’s choice yet.) The user enters his or her choice of “rock,” “paper,” or “scissors” at the keyboard. The computer’s choice is displayed. A winner is selected according to the following rules: If one player chooses rock and the other player chooses scissors, then rock wins. (Rock smashes scissors.) If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cuts paper.) If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps rock.) If both players make the same choice, the game must be played…