2) int a-49, b-7, c; if (a>5 && b<5) c=a*2%b;
Q: A small code that returns the average earning of all employees
A: In the program, a function named average is created to return the average earning of all employees.…
Q: 5.18 LAB: Count characters - functions Write a program whose input is a character and a string, and…
A: Create a 2 variable of type character and string Then take user input in main method After that…
Q: C++ PROBLEM: PASTE INDENTED CODE PLZZ Given the following functions: void increment(int x, int…
A: 1. Explanation: In the main() function, initializing n = 10 and amount = 5 Calling the increment()…
Q: Q4, a mechanical pump whose rated speed is (Sm=15 cfm) is connected by a pipe and valve to a vacuum…
A: Please refer to the following steps for the complete solution to the problem above.
Q: C++ Code Only: One day, Fred and his N friends were playing a card game in which each player throws…
A: We have to write a code to maximize the sum which we get on the front cards, keeping in mind that we…
Q: 4. If myAge, a, and b are all int variables, what are their values after myAge = 39; a = myAge++; b…
A: ++myAge returns the worth of an after it has been increased. It is a pre-increase administrator…
Q: Srikanth is a school student. He studies in class 8th. One day his Math’s teacher came to the class…
A: Please find the answer below :
Q: c++ You are implementing a function that checks the value of the following variable of type char…
A: Function to implement bitwise operator without IFs sand switches
Q: Assume you work as a cashier in a restaurant. You must keep track of the amount of money your…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of an…
Q: 24 / A mechanical pump whose speed is (Sm = 15 cfm) is connected by a pipe and valve to a vacuum…
A: C++ CODE #include <iostream>using namespace std; int main() { // your code goes here float…
Q: In 2022 population of town A is less than population of town B. However, the population of town A…
A: Use a for loop which can iterate for 50 times but we can exit when population of A exceeds…
Q: A bag or cookies holds 50 cookies. The calorie information on the bag claims that there are 10…
A: Answering first question as per the guidelines. The problem is based on the basics of functions in…
Q: n C++ 1. Declare, define, and test the following function to check for order by name: bool…
A: a) Declare, define, and test the following function to check for order by name:bool…
Q: Each function should accept two integer parameters indicating the minimum and maximum X value to be…
A: Since I am not supposed to use loops, i am using recursive functions to print the given pattern.…
Q: C++ PROBLEM. PASTE INDENTED CODE HERE void e(int x, int y) { if(y<2) { cout << x << " "; return; }…
A: PROGRAM CODE: #include <iostream> using namespace std;void e(int x, int y) {if(y<2) {cout…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: def is_leap_year(user_year): if user_year % 100 == 0: #First check if its a century or not…
Q: Consider the statement int val[2] [4] = { 1, 2, 3, 4, 5, 6, 7, 8} ; 4 will be the value of A.…
A: We are given a 2-d array and we are going to find out how an element 4 which is present in the array…
Q: Qno. 1 () Construct a program where implicit conversion would have been done. ii) Construct a…
A: i) #include <iostream> using namespace std; int main() { //declaring int variable int…
Q: 8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas Electric…
A: Coded using C++.
Q: # Define your function here name user values, upper threshold get user_values()…
A: The main logic to print all numbers less than upper_threshold, for i in user_values: if…
Q: This error occurs when a value is not available to a .function or formula #REF!. O #NULL!. O #N/A O
A: Given, This error occurs when a value is not available to a function or formula #REF! #NULL! #N/A
Q: /* function definition to swap the values */ void swap(int x, int y) { int temp; return e;
A: /*Program to swap value of x nd y using swap function*/ #include<stdio.h> //swap function…
Q: y = floor( x + 0.5 ); rounds the number x to the nearest integer and assigns the result to y. use…
A: C++ code for above : #include <iostream>#include <math.h>using namespace std; int…
Q: 3. The C++ statement that displays the values of two float numbers x and y, each in a field length…
A: the function setw is used to set the field width to be used for output operations. It takes…
Q: Use C++: Develop a Tic Tac Toe game that will match a player against the computer. Do’s: Use a…
A: As per question we use only Program must use: functions loops branching string functions
Q: c++ program
A: #include <iostream>#include <bits/stdc++.h>using namespace std; //Array of first 1230…
Q: Write C assignment statements for the following: a. Assign a value of 0 to a variable called between…
A: Answer a. /* Here n,k,between are variables*/if(n<-k || n>k) between = 0;else between…
Q: Write a program that takes in a year and determines whether that year is a leap year. Ex: If the…
A: Program description: C program that prompt user to enter the year value. Then pass the year value to…
Q: 7. [10] (Display Pattern) Write a C++ function called pattern that displays a pattern of stars and…
A: In this program, you need to write C++ function called pattern and also need to write main function…
Q: Write a program that takes in a year and determines whether that year is a leap year.
A: /******************************************************************************…
Q: d. Assume i, j and k are integer variables with i=3 and j=4. Determine the value of k for each of…
A: first lets understand operators used in given statements:j++ : post increment operator:means value…
Q: Write a function that returns the number of days in a year using the following header:def…
A: //********C++ class Calendar program to calculate *******////****************number of years, months…
Q: c++ PLEASE TRACE THE FUNCTION Given the code: void d(int n) { if(n<2) { cout << n << "…
A: Function: When we first time called d(12) it will print 12 and then call d(12/3) i.e d(4) when…
Q: 21. The five line bellow are used to determine the profit or loss of a sale based on the buying cost…
A: Given:
Q: Write a function that returns the sum of all the integer numbers dividable by 3 that are smaller…
A: #defined Sum3 function for calculating sum of numbers which are divisible by 3. def Sum3(limit):…
Q: int x=22, y=17; if((x>30 || y<2)) cout<<"BAHRAIN"; else cout<<"MANAMA"; A MANAMA B BAHRAINMANAMA C.…
A: The given code is: int x=22, y=17 here x is not greater than 30 so first condition is false. y…
Q: Q2: Write a C++ program to compute the value in the "result" variable. For calculation of the result…
A: #include<bits/stdc++.h>using namespace std;int main(){ float a,b,c,r; float result;…
Q: Write C++ statement(s) to allocate space for 10 doubles (using dynamic memory allocation).
A: new is used to allocate space dynamically. syntax: new data-type; statement to allocate space for…
Q: Develop a Tic Tac Toe game that will match a player against the computer.
A: #include <iostream>#include <string>#include <time.h>#include <random>using…
Q: 1. void main () 2. { 3. int a, b, c, x = 0, y = 0; 4. clrscr ( ); 5. printf ("Enter three numbers:…
A:
Q: 8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas 10.1…
A: The main object of the program is to read the starting reading gas consumption and ending reading…
Q: int a=4, b=9,x; //Type the ternary condition here cout<<"x="<<x<<endl;
A: 1- The conditional-ternary operator is the simplest programming language operator that takes 3…
Q: def function_1(a,b): c = (a * b) return c
A: - We need to code for the product code. - We are using python here.
Q: VBA EXCEL PROBLEM: Create a function that receives two positive integers a and b and returns ab.
A: The below program uses loop to count ab. In loop we will multiply a to itself, b times. Exit.
Q: After following statements have executed, find the value of the variable a. int a=15; while (a>0)…
A: Answer: 0 Explanation: While loop: It is an entry control loop that checks the condition while…
Q: Part 1– Substance Test Table 1 below shows the normal boiling points of several substances. Write a…
A: C program to find the whether substance belong to the list
Q: Sub: Data structure Consider the following 'C' routine int DO ( int a[ ], int /b, int ub) { int…
A: The program has two parts: Calling function: It generally pass the value(s) to the called function…
Q: If, A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36} A.…
A: Given sets are: A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36}…
Q: PROBLEM STATEMENT- In a food processing industry, different food products are packed and identified…
A: Algorithm: Load HL register pair with the starting address of the memory block. Move 00H to D…
Step by step
Solved in 2 steps
- Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius value. While the equation is C = 5/9 * (F - 32), as an exercise use two statements, the first of which is "fractionalMultiplier = 5/9:". Check if varlables temperatureFahrenheit, fractionalMultiplier, and temperatureCelsius exist Variable temperatureCelsius does not exist. From Matlabd. Given that an int variable s has been initialized, write a statement(s) that declares a new variable andassign it the remainder of 9 times 8 less than s divided by 4. e. Write a statement(s) that initializes the variables named a, b, c and d to false, ''one'', 'y' and 87.9respectivelyA cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of 1 dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator. C++
- int y = !(12 < 5 || 3 <= 5 && 3 > x) ? 7 : 9 Based on the code above, what is the value of y if x = 1?Suppose p: 'You get a speeding ticket' and q: 'Your insurance rate goes up.' Select the correct symbolization for the statement 'If your insurance rate doesn't go up then you don't get a speeding ticket'. Choices:a)~p→~q b)cannot be determined c)~q→~p d)~q∧~p30 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; __ __ __ __
- 1. Prompt the user and read in the number of a team playing the current game, i.e. Team 1, Team 2, Team 3, etc. 2. Prompt the user and read in the number of the opponent team. It is probably helpful to think of the first team as the home team for this game, and the second team as the away team. 3. Prompt the user and read in a team’s score for the current game. Use the team’s number when asking for the score in your printf statement. 4. Prompt the user and read in the opponent’s score for that game. Again, use the opponent’s team number when asking for the score. 5. Notify the user and repeat steps 3 and 4 in the case that the user enters a negative value. 6. Calculate the points earned by each team and add it to a cumulative score. A win is worth 3 points, a draw is worth 1 point and a loss is zero points. Also update the amount of games played by each team and their goals for and against. 7. Print to the screen the following header and beneath it a line of data that corresponds to…Determine whether the following are valid switch statements. if not, explain why. Assume that n and digit are int variables. A. switch (n <= 2) { case 0: cout << "Draw." << endl; break; case 1: cout << "Win." << endl; break; case 2: cout << "Lose." << endl; break; } B. switch (digit / 4) { case 0, case 1: cout << "low." << endl; break; case 1, case 2: cout << "middle." << endl; break; case 3: cout << "high." << endl; } C. switch (n % 6) { case 1: case 2: case 3: case 4: case 5: cout << n; break; case 0: cout << endl; break; } D. switch (n % 10) case 2: { case 4: case 6: case 8: cout << "Even"; break; case 1: case 3: case 5: case 7: cout << "Odd"; break; }Study the following if statement: if x>10 or x<-10: print('big') elif x>1000000: print('very big') elif x<-1000000: print('very big') else : print('small') For what values of x will the above code print 'very big'?
- Complete the function below that takes in three integers (a,b,c) and returns the number of integers between a and b (inclusive of the endpoints) that are divisible by c. Make sure it tests a and b for divisibility by c! In [ ]: defhow_many_divisible(a,b,c):counter=0# YOUR CODE HEREraiseNotImplementedError()returncounter In [ ]: assert how_many_divisible(10,20,5) == 3 assert how_many_divisible(30,77,7) == 7 PYTHON jYPYTERGiven the code below: type point real a, b end type type (point) v read*, v z=v%a/v%b print*, z end What is the equivalent code for the above statements? Question 6 options: none of the given code choices type point real a, b end type type (point), dimension(2):: v read*, v do i=1, 2 z=v(i)%a/v(i)%b end do print*, z end all the given code choices type point real a, b end type type (point), dimension(2):: v read*, v where (i>0) z=v(i)%a/v(i)%b end where print*, z end real va, vb read*, va, vb z=va/vb print*, z endB) What is the value of speed when the following code snippet runs successfully? const int MIN_SPEED = 45; const int MAX_SPEED = 65; int speed = 55; if (!(speed < MAX_SPEED)) { speed = speed - 10; } if (!(speed > MIN_SPEED)) { speed = speed + 10; } C) Assume: int a = 3, b = 2; double c = 5.0; And evaluate the expression and show each step to indicate the evaluation sequence. (c + a / b) / 8 * 2