Run the following code and display i and k k = 0; i = 0; while(k<1 && i <1) k = 0; i = i+1; i = i-k-1; end
Q: if (x + y> z) return ceil (y), floor (x); else return ceil (z + x) * y: return x + y + z; What is…
A:
Q: 8. Write a program that allows the user to enter two integers and a character If the character is A,…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: Find the errors in the following code: The following statement should assign 0 to z if a is less…
A: The following statement should assign 0 to z if a is less than 10; otherwise, it should assign 7 to…
Q: What is the value of num when the following code snippet runs successfully? int num = 100; if…
A: According to the question below the solution:
Q: What is the value of x in the given code? def getX(num): if num > 10: return 10 else: return 20 x =…
A: b. x = 20 Explanation:- the parameter for getX is 5. So, num =5 condition: if num > 10 then…
Q: Q2: Write a program that inputs a five-digit integer, separates the integer into its individual…
A: Code
Q: Question: Write A Program That Compares The Values Of Y1 And Y2 In.. 3. ( Write a program that…
A: Given:
Q: 2. Write an application that reads the (x,y) coordinates for two points. This should prompt for and…
A: Ans: Code: import java.util.Scanner;class Main{ public static void main(String arg[]) {…
Q: Complete the code that returns the value of ?(?)f(x), which has the value 1 inside the range…
A: Given that, given function f(x), which has the value 1 inside the range -1≤x≤1 otherwise it is the…
Q: Input a number value for LEFT, RIGHT and X. If LEFT is greater than RIGHT, display the first ten…
A: Find the required code in java given as below and output :
Q: “Fix” the following 3 lines of code so that the print the last line of code correctly: age…
A: EXPLANATION: In the first line, there should be “=” to assign the value and to get the int type…
Q: The date June 10, 1960, is special because when we write it in the following format, the month times…
A: As the language is not mentioned, So I have done this program in python.
Q: Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent…
A: The Answer to the following questions:-
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y== 35) y…
A: The output of the code is given below
Q: What will the following code display? x = 3.0 у 3 x is y Infinity True Error False
A: x=3 y=3 x is y, infinity,true,error,false
Q: You will calculate the gross pay for an individual using the formula gross pay = rate * hours You…
A: System.out.println("Enter Health Insurance tax withholding rate:"); double healthtax =…
Q: The great circle distance is the distance betweentwo points on the surface of a sphere. Let (x1, y1)…
A: Note: Programming language is missing in the question. So we will answer this program in Java…
Q: Write an application that allows you to enter nine integers and displays the values, their mean, and…
A: Mean is also known as average. The mean of n integers is calculated by adding all the n integers and…
Q: Write an application that displays the factorial for every integer value from 1 to 10
A: A factorial of a number is the product of that number multiplied by each positive integer lower than…
Q: Q Evaluate the following Java expression, if x-3, y=5, and z=10: ++z+y-y+ Z+X++
A: Prerequisite: ++x is a pre-increment operator. It first increments the variable value and then the…
Q: Ask the user for a name and for a list of test scores. Show the number of tests taken and the…
A: Here I have taken input from the user for the name and then created a list to store the marks. Next,…
Q: Write an application that inputs three integers from the user and displays the sum, average,…
A: You didn't mention any programming language, hence according to Bartleby policy, I have answered in…
Q: Assume you have the following expression: 5+9-3-2*5+4 The postfix expression is:
A: The given is an example of infix to postfix coversion of expression. Following is the given solution…
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y== 35) y…
A: Ans: The value of y after executing the following statement is: int y=36; if(y == 35){ y…
Q: You have to 2 ints from the user( a and b) & print their sum on the console. However, sums in the…
A: Please find the answer below :
Q: Write an application that asks a user to enter three integers. Display them in ascending and…
A: Aim : Write a Java application to read three integers from user and display them in ascending and…
Q: Complete the code that returns the value of f(x), which has the value 1 inside the range -1 <x<1…
A: def function_f(x): #Code will be added here return fval
Q: What is the printout if you entered 2 2.5 when executing the following code? double width;…
A:
Q: What will be displayed on the console when j = 2 in the following code segment? You can give an…
A: Given a code snippet: cout<<"Value of j = "<<j<<endl; for(int…
Q: Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)),…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: ubtractMe(x): k = x - (2/0) if (k <= 6): return 6
A: Lets see the solution.
Q: JAVA PROGRAMMING LAB Write a Java program to takes 2 numbers from the user and print true if one or…
A: Required:- JAVA PROGRAMMING LAB Write a Java program to take 2 numbers from the user and…
Q: Q2: Write a program that inputs a five-digit integer, separates the integer into its individual…
A: Below is the implementation of above problem in C++:
Q: int x = 5, y = 2, z = 3; if ( x z) cout 2 ) { cout << z <<" "<< y-x << endl; cout << z * (x + y)<<…
A: The program is written in C++ Language. Please find the source code and output in the below steps
Q: A pair of primes that vary by two is a pair of twin primes (e.g., 3 and 5, 101 and 103). Write a C++…
A: Introduction: A pair of primes that vary by two is a pair of twin primes (e.g., 3 and 5, 101 and…
Q: Evaluate the following expressions, assume the following declarations: int x = 4; int y = 9/2; int…
A: Given expressions: int x = 4; int y = 9 / 2; int num = 6; num *= x + y;
Q: “Fix” the following 3 lines of code so that the print the last line of code prints correctly:…
A: == should be replaced with = because we are taking input from the user and are incrementing age by 1…
Q: You will write a program that uses a for statement to calculate and display the product of all odd…
A: Java used to answer this question
Q: You have to use nested if else Compare three given number which is largest and print that. The code…
A: Given: To write a java program that prints the largest among three numbers.
Q: What will be displayed by test(3); ? void test( int n) if (n1) cout << "**". else test( n - 1); cout…
A: Recursive call: test(n-1); It perform calling repeatedly until base case is executed. Here…
Q: 3. Re-write the following program by using switch statement. int main() { int code; cout>code; if (…
A: The given problem is related to C++ programming where the given code has used if-else statement…
Q: The value of x is: Write the value ONLY. DON'T WRITE x=... A- (0 3 0) A - 0 0 .......
A: I have given an answer in step 2.
Q: What will be displayed by the following code? int k = 0; while(k <= 10) {k++;} cout << k << endl;
A: I have given an answer in step 2.
Q: int a=3, b=5, c=7, d=-2; if (d > 0) cout << a + b *c << endl; else cout << a * b -c<< endl; A -13 B…
A: This question of condition checking or conditional checking. So, let's just talk about this…
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y == 35) y…
A: Ans: The value of y after executing the following statement is: int y=36; if(y == 35){ y…
Q: What will be displayed when the following code is executed? const int x = 7; int y = 10; y *= 5; y…
A: since you have asked multiple question ,we will solve the first question for you. If you want any…
Q: o Write a program that asks for an integer and reports whether the number is odd or even. Use if ..…
A: The condition for even is Integer must be divisible by 2 The condition for odd is Integer must not…
Q: (Display a pattern) Write a program that displays the following pattern:JJ aaa v vaaaJ J aa v v a aJ…
A: File name: "Solution.java" public class Solution { public static void main(String[] args)…
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Step by step
Solved in 2 steps with 1 images
- Write code else thumbs down! Prefer equationGuess number game. Write a program in Java to: a. Generate a random integer between 1 and 100 (inclusive) and prompt user to guess the number. b. If the guess is not right, give the user the hint like “higher”, “lower”. Allow the user to retry and input the new guess. c. Likely you want to use a while loop to support the user’s multiple attempts. Stop the loop when the user guessed the number. d. Print out the number of attempts for the user for this round of game.Exercise 2 : Write a Java application that computes the sum of even numbers and the product of odd numbers that are in the range [a, b] where a and b are given by the user (without nesting the control statements, to do so you have to use 2 separate loops).
- A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbersas follows:a) product numberb) quantity soldYour program should use a switch statement to determine the retail price for each product. It should calculateand display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the programshould stop looping and display the final results. give answer in java language sample output: Enter product number (1-5) (0 to stop): 1Enter quantity sold: 5Enter product number (1-5) (0 to stop): 5Enter quantity sold: 10Enter product number (1-5) (0 to stop): 0Product 1: $14.90Product 2: $0.00Product 3: $0.00Product 4: $0.00Product 5: $68.70A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbersas follows:a) product numberb) quantity soldYour program should use a switch statement to determine the retail price for each product. It should calculateand display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the programshould stop looping and display the final results.A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbersas follows:a) product numberb) quantity soldYour program should use a switch statement to determine the retail price for each product. It should calculateand display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the programshould stop looping and display the final results sample output: Enter product number (1-5) (0 to stop): 1Enter quantity sold: 5Enter product number (1-5) (0 to stop): 5Enter quantity sold: 10Enter product number (1-5) (0 to stop): 0Product 1: $14.90Product 2: $0.00Product 3: $0.00Product 4: $0.00Product 5: $68.70
- In the switch statement, we can use int type only for the control variables that are being tested in the loop condition. True FalseQ1. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3, return "buzz" if its multiplier of 5 and return "fizzbuzz" if the number is divisible by both 3 and 5. If the number is not divisible by either 3 or 5 then it should just return the number itself? .No written by hand solution IN JAVA - NEEDS DRIVER AND CLASS PROGRAM Average Rainfall Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month.
- Write an application that displays the factorial for every integer value from 1 to 10. A factorial of a number is the product of that number multiplied by each positive integer lower than it. For example, 4 factorial is 4 * 3 * 2 * 1, or 24. The output would then be The factorial of 4 is 24.Anagram words Write a C code that asks users to enter two words, one after the other and checks if these words are anagrams (permutations of the same letters). For instance, the words “smartest” and “mattress” are anagrams. Examplea Run 1: Please enter first word: lookplease enter the second word: coolSorry! “cool” and “look” are not anagrams. Run 2: Please enter first word: masters please enter the second word: smartes Yes! “masters” and “smartes” are anagrams. Hint: If you sort the two words that are anagrams, they will become identical! For instance, “smartest” and “masters” both sort to “aemrsstt” You can use all functions in <string.h> Sorting a string is exactly similar to sorting an array. You just need to know the length of the string and make sure you do not touch the terminating null.stoppingDistance = speed * (2.25 + speed / 21)Write a program which determines whether a vehicle’s tailgating distance is safe.The program should read in the speed of the vehicle and the vehicle’s tailgatingdistance. The program should then calculate the distance that would be required tostop the vehicle.If the stopping distance is less than the tailgating distance, your programshould print “No problem.” If the stopping distance equals the tailgatingdistance, your program should print “Minor wreck.” If the stopping distanceis greater than the tailgating distance, your program should print “Majorwreck!”