Assuming the following code, what will the value of x be after the code is executed: x = 20 if x % 2 == 0: x +=5 if x % 5 == 0: x += 5 elif x % 10 == 0: x = 10 else: x = 0
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: Start Input caffeineMg yourValue <- caffeineMg yourValue <- yourValue/2 print After 6 hours…
Q: The average of a set of values can be calculated by the following equation. Write the proper code…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Write a Pseudocode for the given problem: Read the bill amount from customer. If the bill amount is…
A: Use separate variables to store billAmount, discount and finalBillAmount calculated after applying…
Q: 30. If originally x=4, what is the value of x after the evaluation of the expression: x+=x+3
A: The value after evaluation will be 11. #include <iostream> using namespace std; int main(){…
Q: Write a Little Man program that prints out the multiples of 9 starting from 9 to 99. Also keep a…
A: Given: Multiples of 9 starting from 9 to 99 Total and output at the end the sum of 9+18+...99.
Q: The following table shows the rate of commission that will be paid to the salesman according to the…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the main function.…
Q: // This pseudocode is intended to determine whether students have // passed or failed a course;…
A: Pseudocode Pseudocode is a loose way to describe programming which doesn't need to conform to any…
Q: Prompts the user for 4 one-word items and their corresponding prices in US dollars .Compute the…
A: The answer is given below:-
Q: The following code correctly determines whether x contains a value in the range of 0 through 100,…
A: We are going to see if the given statement is true or not. I have pasted the code along with the…
Q: Referring to the program below, predict the 'printf' output after program execution. #include void…
A:
Q: The program below simulates tossing a fair coin N times. The program computes the longest sequence…
A: Let's see step by step: 1. const int HEADS = 0; const int TAILS = 1; here HEADS is initialized…
Q: Your team was asked to program a self-driving car that reaches its destination with minimum travel…
A: Algorithm is a step-by-step process of solving a problem Input the distance of various paths in two…
Q: Write a program that will accept user's info: fullname,age,course abd section. Display all the…
A: 1. Flow chart Source Code import java.util.Scanner; class ReadInfo { public static void…
Q: Complete the pay computation to give the employee 1.5 times the hourly rate for hours worked above…
A: Python code: hours = 45 rate = 10 overtimeRate = 1.5 grossPay = 0 if hours < 40: grossPay =…
Q: The pseudocode below is supposed to determine a student�s letter grade based on the student's exam…
A: Pseudocode: Pseudocode is writing the program instructions in a simple English language. Pseudocode…
Q: Given that x = 60 what would the following code output? if (x !=64 && x>59) { SP cout 60)…
A: Here, Code is given with if-else block.
Q: Create a calculator program that accepts selection input followed by two integer inputs repeatedly…
A: Code: #include<stdio.h>#include<conio.h>int main(){ char choice; int a,b, result =…
Q: You must have 2 functions: one computes the average and the other finds the letter grade. The…
A: A) Calculate Average def calcAverage(score1, score2, score3, score4, score5): return (score1 +…
Q: Using any programming language, write a program that will solve the given problem below: Write a…
A: The answer is coded in Python Language.
Q: MPUTER PROGRAMMING... Choose all the valid variable names. A. point_2_point B.…
A: Choose all the valid variable names. A. point_2_pointB. wage125C. savings#accountD. _grossE. annual…
Q: In Visual Studio, use assembly language to solve the following problem Based on the following…
A: I have answer this question in step 2.
Q: A code segment is intended to display the following output. up down down down up down down down…
A: When we encounter repeating patterns in the required output, rather than declaring that particular…
Q: // This pseudocode is intended to determine whether students have // passed or failed a course;…
A: Flow chart-A flowchart is a picture of the separate steps of a process in sequential order.…
Q: What is the value of x if m-4 and b=12? def mystery(m, b): y = 71 x = (y - b) / m return x…
A: Required: Output of the given python program
Q: Q: Write a program which input examination marks and test it for the award of a grade. The marks are…
A: 1) Since programming language is not specified, I have written program in python 2) Below is program…
Q: The programming language is C++, write a program base on the given statement. Create a program…
A: 1. Input the Real Estate Value 2. If the value < 2,50,001, 1. tax = 5% of value 3. Else, if…
Q: This is a MULTIPLE ANSWER question, which means you are able to select one or more answers as being…
A: We need to find correct option(s) regarding given Python code.
Q: Total marks Grade 80-100 A 70-79 В 60-69 C 50-59 D 0-49 F Enter matric number :1111 Enter test1 and…
A: Given: Write a C program and draw a flowchart. Total marks Grade 80 - 100 A 70 - 79 B 60 -…
Q: = int(input("Enter value for x:")) if x == -1 : print("Disagree") elif x == 0: print("Neutral")…
A: Please find the answer below
Q: What is the value of y after the following pseudo-code program executes? given a variable "y" set…
A: Y=16
Q: The following program is expressed in pseudocode with one incomplete statement (line 4). What needs…
A: HERE x = 1 and y = 6 from line 3, x = x+y, x = 1 + 6 = 7 now, we want the value of y as 42 and 7*6…
Q: salesman has n things to sale .The cost price of all n things is different out of which p things he…
A: The c program is written for calculating the net profit / loss based on the input from the user.…
Q: Suppose income is 4001, what is the output of the following code? if (income > 3000) {…
A: The conditional statement if/else is used to check whether the condition is true or false. Syntax:…
Q: Convert the following code into descriptive code, and verify using White Box Testing. a = 2 b = 10…
A: White box testing is software program checking out method wherein inner structure, design and coding…
Q: Need a JS Code that will generate a random number.
A: Javascript: It is a dynamic programming language. It was invented by Brendan Eich in 1995. It can be…
Q: Write the IPO CHART and Pseudocode. Write a program that will compute the total amount of a…
A: I have given pseudo code and actual code in c++.
Q: Consider the code below and show the code's output when executed. Pay attention in the details.…
A: Given python code snippet smallest=-1for number in [9, 3, 17,51, 69, 14, 7]: if number <…
Q: Input in a number representing a car type, until the number 0 is input. There are three types of…
A: Here we need to write pseudo code. Pseudo code is like code which doesn't need to be error free. It…
Q: If originally x = 4, y = 0, and z = 2, which is the value of x, y and z after executing the…
A: Code(in Java)-class Main{ public static void main(String[] args) {…
Q: Lazy evaluation is the key to ensuring only the important parts of compound boolean…
A: This question comes from Python Programming which is a paper of Computer Science. Let's discuss it…
Q: Q1: What is wrong in the following code? if (score >= 60.0) cout « "Grade is D"; else if (score >=…
A: The code given is : if (score >= 60.0)cout « "Grade is D";else if (score >= 70.0)cout <«…
Q: Consider the following pseudocode, function Kn) if n=1: return 1 else: return (n-1)+Kn-1) } Answer…
A: Note: The answers of the first three subparts are given. Please repost the remaining subparts.…
Q: A variable like userNum can store a value like an integer. Extend the given program to print userNum…
A: The required code is as follows:-
Q: a. The payment of part time workers of Mayang Sari Enterprise is based on number of hours worked and…
A: In the given problem, Given the number of hours, we need to calculate the payment.
Q: Find the error in each of the following code segments and explain how to correct it.a) x = 1;while…
A: Introduction: AS PER OUR POLICY “Since you have posted a question with multiple sub-parts, we will…
Q: If you have the following statements: int x = 0; for (x=1; x<4; x++); cout<<"x="<< x; The output…
A: 1) Code snippet in question does below activities it declare variable x initialize it to 0 Runs a…
Q: If a person is 17 years old, what will be the outcome if the following snippet of code is executed.…
A: Line by Line code: if NOT(age < 18) it means that if the value returned by if is true then not…
Q: the following code is not * true because 1Dim j as integer, i as integer, Zas single 2 Dim k as…
A: Module VBModule Sub Main() dim j as integer, i as integer, z as single dim k as…
Q: Write the pseudocode for the following scenario: A manager at a 2nd hand car dealership wants to…
A: As Pseudocode is basically blueprint of Algorithm. It is not a complete code. It is usually steps…
Q: What value will be assigned to the numeric variable x when the following statement is executed x 4 \…
A: In this program, we have an statement x= 4 / 2 *4 Found out the output value of x. As the language…
Assuming the following code, what will the value of x be after the code is executed:
x = 20
if x % 2 == 0:
x +=5
if x % 5 == 0:
x += 5
elif x % 10 == 0:
x = 10
else:
x = 0
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- raph EECP1290: Computer Programming for Engineering Write a program to calculate the K value using if else condition If P value is more than 9 then K = M/2 – vP+C If P value is less than or equal to 9 then K = M/2 + /P +C I= Where C is a constant with value 1.7elearning.ibrict.edu.om EE EECP1290: Computer Programming for Engineering-CLA#1 Write a program to calculate the K value using if else condition If P value is more than 9 then K = M/2 VP+C If P value is less than or equal to 9 then K = M2 + P+C Where C is a constant with value 1.7 Sample output: Enter p value:16 Enter M value:4 p, M and K values are:16.000000 4.000000 -0.300000 Sample output: Enter p value:9 Enter M value:4 P, M and K values are:9.000000 4.000000 6.700000 >0199% 10:00 docs.google.com/forms 13 last constant Problem 1 At a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and how long he delayed in submitting, and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes) : 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0 Sample Run 4: Enter your initial grade: 72 Enter the late submission time (in minutes) : -2 Time should be positive Your answer Problem 2 Write a Java program integers day. month, and vear. You are NOT required to check if the values entered by the user are in give the user the ability to determine the day of a given date. The user shall…
- x=0:pi/10:2*pi; y1=sin (x); xlabel ('x (rad)') ylabel ('sin (x)') title ('sine function') * plot(x,y1,'r:+') ste function 06 04 02 02 06 08 -1 Option 1 O ste function 08 06 02 02 04 06lif the following code, what will be the variable "value" equal to when y=2 is being executed: def foo(value) : value = value + 2 def main(): x = 1 foo(x) y = 2 Variable "value" does not exist when y=2 is being executed. 02Assignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: You MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output Answer assignment 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450…
- Brute force equation solver this is python program. Numerous engineering and scientific applications require finding solutions to a set of equations. Ex: 8x + 7y = 38 and 3x - 5y = -1 have a solution x = 3, y = 2. Given integer coefficients of two linear equations with variables x and y, use brute force to find an integer solution for x and y in the range -10 to 10. Ex: If the input is: 8 7 38 3 -5 -1 Then the output is: 3 2 Use this brute force approach: For every value of x from -10 to 10 For every value of y from -10 to 10 Check if the current x and y satisfy both equations. If so, output the solution, and finish. Ex: If no solution is found, output: No solution You can assume the two equations have no more than one solution. Note: Elegant mathematical techniques exist to solve such linear equations. However, for other kinds of equations or situations, brute force can be handy. ''' Read in first equation, ax + by = c '''a = int(input())b = int(input())c = int(input()) ''' Read in…//PROBLEM 1/* This program should play a game with the user asking her to guess a target number (randomly generated integer between 1 and 10). The user gets 3 attempts. If she gets it wrong, the program tells her to go up or down, depending on whether her number was less or more then the target. The output may look like this, for example: ============= Guess the number between 1 and 10 in THREE attempts. Enter your first guess: 4 Nope. Go up. Enter your second guess: 6 Nope. Go down. Enter your third and final guess: 5 You got it! CONGRATULATIONS! ============= or like this: ============= Guess the number between 1 and 10 in THREE attempts. Enter your first guess: 4 Nope. Go up. Enter your second guess: 6 Nope. Go up. Enter your third and final guess: 8 GAME OVER! You lost! The number was 9A business law class of 25 students takes a midterm exam that has 100 true- or-false questions. The instructor, who is also a computer fanatic, wants to devise a program to obtain a printout with the student's name, score, and letter grade, according to the following schedule: 50 or below F 51 - 55 D 56 – 60 C- 61 - 65 66 – 70 C+ 71 - 75 B- 76 - 80 81 - 85 86 – 90 B B+ А- 91 - 95 A 96 – 100 A+ In addition, the instructor wants to include the total number of students scoring each of the 11 possible grades. How would you use the FORTRAN language to solve his problem?
- int y=0,i; for (int i=0;i<10;++i) y+=i; 36 66 45 55The value for T can be determined by the series equation: 1 1 1 1 1 1 TT = 4 X - 5 7 11 13 Write a program that prompts the user to enter the number of iterations to be executed to determine the value of T.Refer to the following code. Which line may be used to complete the code so it would not result to an error? count = 15 while count > 5: print (count) A none of these; the code is complete by itself (B) count == count (C) count = count - 4 (D) count += 1