6. If you run the following program, in which order the statements of this program will be executed? Your answer should be a sequence of comma separated line numbers without any extra spaces, e.g., 1,2,3,4,5,6,7,8 etc. def fun_a(): 2 print("aa") 4 print("printing...") def fun_b(): 7 print("bb") 8. def fun_c(): print("cc") 10 11 12 print("printing again...") 13 fun_c() fun_a() fun_b() 14 15 16 17 18 print("done")
Q: If you have the following statements: int a=2, b=3, c=4; double z=4.5, w=6.7; const float f=8.9; The…
A: Here variable a and b are of integer datatype whose initial value are 2 and 3. Datatype of variable…
Q: The steelwork.py program, given below, creates three types of steel objects. Carbon steel (Steel) is…
A: Actually, python is a easiest programming language. It has a concise(less) code. It is a dynamically…
Q: 2) A BMI Calculator: the body mass index (BMI) is a measure used to determine whether a person is…
A: Java Code import java.util.Scanner; public class Test { public static void main(String[] args) {…
Q: Suppose a, b, and sum are int variables and c is a float variable. What value is assigned to each…
A: b+=c*a ; b = b + c*a = 4 + 3.8*9 = 4 + 34.2 = 38.2 So value of b= 38 Thus a = 9, b= 38, c=3.8 sum=17…
Q: 3. B) What is the value of num when the following code snippet runs successfully? int num = 100;…
A: I give the solution to both with output screenshot I also give the code ,output and code screenshot…
Q: Part H: Worker Pay Write a program that asks the user to enter their name, pay rate (in $/hr) and…
A: steps for calculating total amount is if hour > 40: total = 40 * rate + (hour-40) * 1.5 * rate…
Q: 6. A microwave oven manufacturer recommends that when heating two items, add 50% to the heating…
A: Hey, since multiple questions posted, we will answer first question according to our policy. If you…
Q: int a, b, c; a = 1; b=2; c= 2; What are the values of a, b, and c after executing the following…
A: Since the Programming language is not mentioned in the question, we will answer this question in C++…
Q: int mycount=0; int p-30; while(mycount<p) { printf("%d",p%3); P-p/2; mycount++; }
A: c- 3 is the right answer and output -0 0 1
Q: After following statements have executed, find the value of the variable a. int a=5; while (a<=12)…
A: Please find the answer below :
Q: Tuary. deposit is then made of £1000 at the end of every month for the next 12 months. Interest is…
A: a. Code: amount=zeros(1,12);amount(1)=100000;interest=zeros(1,12);fprintf('Month\tInterest…
Q: 3.5 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: Here I am using Java language to solve this question. Java Code: import java.util.*; public class…
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: Write a program in which user is asked to enter two integers (divisor and dividend) and computes the…
A: Program Explanation :- In this Program, the user is required to enter two numbers (separator and…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A:
Q: 1. Write a program that calculates the user's body mass index (BMI) and categorizes it as…
A:
Q: (B)What should be printed on C++ screen? #include void main() { int x = 5; if(x++ == 5)…
A: Explanation: iostream.h is a header file which contains defalut functions like cout ,cin . Here you…
Q: EXPLAIN THIS CODE EACH LINE #include #include int main() { char name[20]; int…
A:
Q: (4) char chArray[] = {'E', T, 'C', 'D', 'F', 'F'}; (5) int a 5, b-7, c; after the statement…
A: Correct General statement for any array in C is <datatype> <variable_name>[] =…
Q: Write a program that simulates flipping a coin to make decisions. The input is how many decisions…
A: For the given question, we have to design a Python program that does/includes the following :…
Q: Activity #2: Write a program that computes parking fees for a garage with the fee structure given in…
A: Objective: This program reads the number of hours parked for vehicles and computes the total charge.…
Q: 3. Write a program that computes and interprets the Body Mass Index (BMI). The program prompts the…
A: Take two inputs from user for height and weight convert height in meter(h*0.0254) and weight in…
Q: The homework is to re-write the previous program so that the user does not need to enter any…
A: The homework is to re-write the previous program so that the user does not need to enter any…
Q: * What will be the contents of the variable x after the following statement is executed? x =…
A: Answer in step 2
Q: Write a program that displays a table of inches from 1-12 and equivalent lengths in centimeters. You…
A: Please Indent the code as shown below :
Q: 3- How many the number of erTors in the following sub_ program? Hinclude void main( ) intnum, sum -…
A: the answer is option d 7
Q: in this program. a, int b, int *c, int *d, int *resu a, int *b, int *c, int *d, int *resu int *res
A: I have written the code below:
Q: double num1 = 1234567.456, num2 = 123.456, num3 = 123.456, num4 = 123456.789; int num5 = 123456;…
A: [Note: In the below-given program code, single quotes are used to display the padding field.]…
Q: One or more of the following statements could be true. Tick the true statements and leave the false…
A: We will go one by one from the statments and try to understand them . In the first statment it is…
Q: 2. Write a program that determines a student's grade. The program will read three scores and…
A: Below is the required C++ program: - Approach: - Import the header file and include the namespace.…
Q: Exercise 6: Two points in a plane are specified using the coordinates (x1, y1) and (x2, y2). Write a…
A: Since it is unclear which question you want, my code below is answer to both questions 6 and 7.
Q: Q7. If you have the following statements: int main() int a=10, b; b=++a + a; cout<<b<<","<<++a;…
A: #include <iostream>using namespace std; int main(){ int a=10, b; b=++a + a;…
Q: ssume variables a, b, c, are declared int and are initialized. Write code that will find the largest…
A: Given: Assume variables a, b, c, are declared int and are initialized. Write code that will find the…
Q: Q3)- The following program contains errors, rewrite the program with no errors. Then write what the…
A: List Of Program lines that contain error const int k = 5; The above code contain error because…
Q: 6.30 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input is…
A: NOTE - This is a Java question, so I have written the code in the Java programming language. Here I…
Q: Exercise 4: Write a program that reads two pieces of information: the hourly wages and the number of…
A: Problem:- we need to calculate net salary of an employee based on hourly pay wage and working hour…
Q: Q2} The following is list of 22 exam scores. Write program that calculate average of this score and…
A: Given Exam Scores, 64, 51, 97, 70, 65, 87, 100, 79, 85, 17, 71, 75, 48, 79, 98, 53, 77, 57, 83, 69,…
Q: 5. How many the number of errors in the following sub_ program? #include void main( ) { intnum, sum…
A: Here in Error 1) intnum,sum=1; we should use space between int and num correct code int num,sum=1;…
Q: 2.12 LAB: Driving costs Driving is expensive. Write a program with a car's gas mileage…
A: Code: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon): return (driven_miles…
Q: Examine the code snippet below, and indicate what are the Arguments? int result = Sum(5,6,7); ..…
A: The values that are passed during a function call are called arguments.
Q: Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to each…
A: static_cast<> is a compile time casting. It is used for implicit conversions between types.…
Q: QI: tinclude (a) Write two different techniques to declare and initialize a variable with an…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: **3.22 (Geometry: point in a circle?) Write a program that prompts the user to enter a point ( x, y…
A: The given problem is to find the position of a point in x,y cordinate on x-y axis and find whether…
Q: 1- Write a program in which the user is asked to enter his age based on the year (assuming the…
A: Take input from user. check if the number is positive integer or no. and if the number is positive…
Q: 3. Write a program that computes and interprets the Body Mass Index (BMI). The program prompts the…
A: Prompt to enter the weight in pounds. Store the value in a variable. Prompt to enter the height in…
Q: 2. Write a program that computes the cost of painting and installing carpet in a room. Assume that…
A: Actually, program is a executable software that runs on a computer.
Q: 20.5 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input…
A: PROGRAM CODE: # import the required modulesimport random# start the definition of the function to…
Step by step
Solved in 5 steps with 2 images
- If you run the following program, in which order the statements of this program will be executed? Your answer should be a sequence of comma separated line numbers without any extra spaces, e.g., 1,2,3,4,5,6,7,8 etc.The homework is to re-write the previous program so that the user does not need to enter any freezing point information. Only the salinity of the water. Thefull question in the picture Code in C Previous Program #include <stdio.h>#include <math.h>int main(void){ /* Declare variables. */ double a, f_a, b, f_b, c, f_c; /* Get user input from the keyboard. */ printf("Use ppt for salinity values. \n"); printf("Use degrees F for temperatures. \n"); printf("Enter first salinity and freezing temperature: \n"); scanf("%lf %lf",&a,&f_a); printf("Enter second salinity and freezing temperature: \n"); scanf("%lf %lf",&c,&f_c); printf("Enter new salinity: \n"); scanf("%lf",&b); /* Check that salinity is between first two points. Note the order of a and c is not known, so I am checking for both orders (a>c and a<c). I will exit the program with a code 1 if this check fails. */ if (!(((a<b)&&(b<c))||((a>b)&&(b>c)))) { printf("\nThe…C++ In this task, you are required to write a code that converts an Octal number into its equivalent Decimal value or vice versa. The user first selects the conversion choice by inserting 1 or 2. Choice 1 is followed by inserting an Octal integer and getting its Decimal equivalent value as an output. Choice 2 requires inserting a Decimal integer and prints out its Octal equivalent. The Octal numeral system, is the base-8 number system, and uses the digits 0 to 7, that is to say 10 octal represents 8 Decimal and 100 octal represents 64 Decimal. Convertion from an Octal integer into Decimal In the Decimal system, each number is the digit multiplied by 10 to the power of its location (starting from 0). For example: 74 decimal = 7 x 10^1 + 4 x 10^0 1252 decimal = 1 x 10^3 + 2 x 10^2 + 5 x 10^1 + 2 x 10^0 each number is the digit multiplied by 8 to the power of its location (starting from 0). For example: 112 octal = 1 x 8^2 + 1 x 8^1 + 2 x 8^0 Converting an Octal integer into…
- 1 .Write a program that prints out three different tic tac toe winning results. Make each one bigger than the last, separated by more spaces and lines: 2. Write a program called TriangleArea, which calculates and outputs the Area of a triangle with a Base value of 3.5 and a Height value of 4.85. The formula for the area of a triangle is: 1/2 ×???? × ????ℎ?. Your program should output the correct answer. 3. Write a program that will tell me the conversion of 60 miles, into kilometers. Remember that 1 mile is 1.60934 kilometers. 4. Write a sequence of output statements to display your initials (2 – 3 letters) using a cool pattern for each letter. For example, here is a simple pattern for the initials IL: II LL II LL II LL II LL II LL II LL II LL II LL LL LL LL Use around 8 statements to complete this exercise. 5. Write a program that asks the user to input a number. Then…In Chapter 4, you created a program that generates a random number, allows a user to guess it, and displays a message indicating whether the guess is too low, too high, or correct. Now, create a modified program called GuessingGame2 in which the user can continue to enter values until the correct guess is made. After the user guesses correctly, display the number of guesses made. Recall that you can generate a random number whose value is at least min and less than max using the following statements: Random ranNumber = new Random(); int randomNumber; randomNumber = ranNumber.Next(min, max);4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }
- (Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.30 Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to each variable after each statement executes? Suppose a = 6, b = 3, and c = 2.2. (14) a b c sum sum = static_cast<int>(a + b + c); __ __ __ __ b += c * a; __ __ __ __ c -= a; __ __ __ __ a *= 2 * b - c; __ __ __ __C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.
- Create a program that reads integers from the user until the enter key is pressed. Onceall of the integers have been read your program should display all of the negativenumbers, followed by all of the zeros, followed by all of the positive numbers. Withineach group the numbers should be displayed in the same order that they were enteredby the user. For example, if the user enters the values 3, -4, 1, 0, -1, 0, and -2 thenyour program should output the values -4, -1, -2, 0, 0, 3, and 1. Your programshould display each value on its own line.Find out the final values of a,b and c where following expressions are executed sequentially:[4]int a = 2, b =3, c;a = (b++) + (++b) + a;c = a>b ? a:b;b = (a++) + (b--) + a;c = c++*b--;a. Write a program that takes integers as arguments and adds them.b. Write a program that takes integers as arguments and multiplies them.c. Write a program that takes integers as arguments & adds & multipliesthem using the above two programs.