(a) Write two different techniques to declare and initialize a variable with an example. (b) Write a program that simulates a simple cakulator. It reads two integers and a character. If the character is a +", the sum is printod; if it is a -', the difference is printed; if it is a *, the product is printed; if it is a ", the quotient is printed; and if it is a "%", the remainder is printed.
Q: Answer properly(editable code , output screenshot) is must Write a C++ program to input…
A: Algorithm: 1.Declare main function 2.Declare variables named no_of_units to take units from the user…
Q: What is the output of the code below? def mystery_func(input, num, t = 0, x = 10, y = 10) [this…
A: The output of the code is 1.
Q: 6. Write a program segment using switch selection for the following statements. If the grade is A,…
A: As there is no programming language mentioned so program is attempted in c language Start input…
Q: Write a program that takes a range from the user and display all the even numbers between the range…
A: Note - Since there is nothing mentioned about the programming language to be used, so this program…
Q: 5) Write a program that reads three numbers and prints "increasing" if they are in increasing order,…
A: logic:- input three numbers . use > and && operator to check if they are in ascending…
Q: 4)Write program that input the user age and print the sentence: a) You are child if the age is less…
A: There is not mentioned any programming language so I used JAVA Step 1 : Declare a variable age and…
Q: 17. Write a program that calculates and print the numbers (from 0 to 10) and it squares and cubes.
A: Mathematically we know that square of a number is its multiplication by itself. For example if n is…
Q: Write a program that displays every integer between 1 and 100 that is divisible by 5 or 7, but not…
A: Algorithm: 1.Include required header files 2.include main function 3.create a for loop 4.use if…
Q: Let the following variable is declared in the C++ program as (int X;). Write one statement that…
A: Include the necessary header files. Declare the integer variable X. Get the input from the user. The…
Q: Can I please have the answer in C++ language 4.7: Time Machine Your time machine is capable of…
A: Lets see the solution.
Q: Q2/ Write a program that reads a code and temperature. If the code is 1, convert from centigrade to…
A: C programming: C programming is a procedural programming language that was developed by Dennis…
Q: (De Morgan’s Laws) In this chapter, we discussed the logical operators &&, ||, and !.…
A: According to De Morgan's Law, !(condition1 && condition2) = (!condition1 || !condition2)…
Q: Write a program to print the static F as shown below
A: Since programming language not mentioned using C++.
Q: Write a python program that displays every integer between 1 and 100 that is divisible by 5 or 7,…
A: Using While loop output : Editable code : i = 1while i<100 : if i % 5 == 0: if i…
Q: Write a single C statement to accomplish each of the following: c) Test whether the value of the…
A: Answer of the given question is as below: Approach: 1. Declare the variable count 2. Ask user for…
Q: Write program c++ to input a variable can accept any of the following value: A, & , B, 1, *, 3 as…
A: Sample Response: //C++ program to accept a value and prints its data type and…
Q: Q3: Write a program of c++ that prints the day number of the year, given the date in the form…
A: PROGRAM: // defining header file #include<iostream> using namespace std; // declaring…
Q: Given a and b are int variables and c is a double variable. The initial value for a, b, and c are 8,…
A: b++ is a post increment operation where the result in b updates after expression evaluation and thus…
Q: What is the value assigned to x after the following C expression is executed? int a=1, b=5, x; x=…
A: Please find the answer below
Q: (b) Given a and b are int variables and c is a double variable. The initial value for a, b, and c…
A: Postfix Operator: value of the variable is first used the expression and its incremented by 1. Since…
Q: (Racket) Write sequences of cars and cdrs that will pick the symbol 'x out of the following…
A: Given: (Racket) Write sequences of cars and cdrs that will pick the symbol 'x out of the following…
Q: Write a program to compare two fractional numbers by overloading relational operators (,=,==, !=)
A: //Please follow the coding in pictures #inсlude<iоstreаm>#inсlude<сstdlib>using…
Q: Program is to be written in C (1) Prompt the user for a string that contains two strings…
A: Based on our rules, we should answer only the first question when multiple questions are posted.…
Q: 9- Write a program which read a number of 3 digits and check if (units, tens, hundreds) digit is…
A: #include <stdio.h>int main(){ int digit[3],i=0,a=5; // Input the digit as an array…
Q: Let the following variable is declared in the C++ program as (int X;). Write one statement that…
A: cout is the keyword used to print if is the keyword used to check the condition
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: Q1/A-Write a program to compute the mass flow rate of a fluid (in kg/sec) through a thermal unit…
A: Code: Dim A as DoubleDim M as DoubleDim Po as Double Dim K as DoubleDim R as DoubleDim T0 as…
Q: Exercise 5 : Write a C++ program that asks the user to enter the value for input variables, and…
A: I have provided both the programs in C++ language in step 2 with its outputs.
Q: use c++ Write a program that prompts the user to input a string (a string can be a word, a phrase…
A: In step 2, you will get the c++ code. In step 3, you can see the sample output.
Q: 3) Given three decimal numbers x, y and z. Write a boolean expression that evaluates to true if an…
A: I have provided the boolean expression in step 2.
Q: Q3] ( Write a program to enter a value of x and compute the value of y where x if x ≥ 0 -x if x<0 y
A: In mathematics function is the expression or rule or law which defines the relationship between the…
Q: Q7 Draw the flowchart and write a C program using else if to calculate the total amount to be paid…
A: The program prompts the user to enter basic loan amount and number of years. Basic loan amount is…
Q: Exercise 5: Write a C++ program that asks the user to enter the value for input variables, and…
A: The c++ code along with the output for division operation has given is step 2.
Q: Write a C++ program: Blood sugar is considered normal if its rate is less than 140 and greater than…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the main function.…
Q: 2-Write a program which will read in three integers and will output the sum and average of the…
A: Program Plan: Input 3 integers from the user. Calculate the sum and average of the numbers.…
Q: 6. Write a program to read a number representing the time in 24-hours (i.e., 4-digits ). Then find…
A: import java.text.SimpleDateFormat;import java.util.*;import org.apache.commons.lang3.time; class…
Q: . In the sport of diving, seven judges award a score between 0 and 10, where each score may be a…
A: The program defines two variables: difficulty: for deciding the difficulty of each dive.…
Q: Q/ A College of engineering is advertised to call high school graduates to apply to its departments…
A: Problem Statement: A College of engineering is advertised to call high school graduates to apply to…
Q: Complete the program to read the needed values from input, that the existing output statement(s) can…
A: here is Programming Language is not mentioned so I will provide answers in c++ language. Code:…
Q: Write assignment statements that perform the following operations with int variable i, double…
A: GIVEN: int i; double d1, d2; char c; A) Subtract 8.5 from d2 and store…
Q: (c) You are required to create a program that reads a letter of the alphabet from the user. If the…
A: We want to check if the letter input is vowel or not, for y we have added a check, and printed…
Q: in C Write a program to calculate the size of a room and the costs to strip and sand, and seal it.…
A: 1) Below is C Program to calculate the size of a room and the costs to strip and sand, and seal it…
Q: Suppose x, y, and z are int variables and x = 18, y = 5, and z = 4. What is the output of each of…
A: Given, cout << "x = " << x << ", y = " << y << ", z = " << z…
Q: 2.Write a program that prompts the user to enter a positive integer and obtains its square root in…
A: The program is written in Java. Please find the source code in the next step.
Q: 2. Construct a program where you deciare and initialize a constant variable, now try to reassign…
A: EXPLANATION: The constant variables are basically those variables which can not be modified at the…
Q: 5) Write a program that reads three numbers and prints "increasing" if they are in increasing order,…
A: """Program reads three number and prints increasing, decreasing or neitherbased in its values…
Q: Write a Program to that will take input from the user and tells if the user entered Even or Odd…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Step by step
Solved in 2 steps with 2 images
- (De Morgan’s Laws) In this chapter, we discussed the logical operators &&, ||, and !. DeMorgan’s Laws can sometimes make it more convenient for us to express a logical expression. Theselaws state that the expression !(condition1 && condition2) is logically equivalent to the expression(!condition1 || !condition2). Also, the expression !(condition1 || condition2) is logically equivalentto the expression (!condition1 && !condition2). Use De Morgan’s Laws to write equivalent expressions for each of the following, and then write a program to show that both the original expressionand the new expression in each case are equivalent.a) !(x < 5) && !(y >= 7)b) !(a == b) || !(g != 5)c) !((x <= 8) && (y > 4))d) !((i > 4) || (j <= 6))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.c++ Write a program to use enumeration type to represent the seven colors of the rainbow, i.e. red, orange, yellow, green, blue, indigo and violet, as the enumerators in sequence, and red starts from 1. Then, ask the user to choose a value between the range of 1 – 7. If the user enters 3, the output will tell the user yellow has been chosen, and also display the previous and next colors of the chosen colors. If the user enters 1 or 7, display the chosen color and only next/previous color is displayed accordingly. Write the program in an infinite while loop, until a number which is beyond the range of 1 – 7 is entered. The sample output is as follows, Enter a number in the sequence of the rainbow color (1-7): 7 Violet is chosen. The previous color is indigo. Enter a number in the sequence of the rainbow color (1-7): 1 Red color is chosen. The next color is orange. Enter a number in the sequence of the rainbow color (1-7): 3Yellow is chosen. The previous color is orange and next…
- i). Write a C++ program to prompt the user to input her/his age and print it on the screen, asshown below.Your age is 20 years old. ii). Write a C++ program that asks the user for a number n and gives him the possibility to choosebetween computing the sum and computing the product of 1,...,n iii). Write a program that asks the user for a number n and gives him the possibility to choosebetween computing the sum and computing the product of 1,...,n. Expected output: 0,30,25,28The programming language is C++, write a program for each items base on the given statement. 1. Due to poor result of an examination, your professor decided toincrease each student by 1 point. Input the grade and print the newgrade. If the original grade exceeds 100, then it remains as such. 4. A college student who is registered for 21 units or more is consideredas full time student. The tuition fee for full time is 7000. A part timestudent is charged 300 per unit for tuition. Given the number of unitsa student is registering, calculate and print his tuition fee on the basisof the given criteria.Use C++ Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. Ex: If the input is: 3 the output is: heads tails heads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded. Note: A common student mistake is to call srand() before each call to rand(). But seeding should only be done once, at the start of the program, after which rand() can be called any number of times. Your program must define and call the following function that returns "heads" or "tails".string HeadsOrTails()
- Write out a truth table (including all four cases) for the following expressions. Here, p,q and r represent simple statements that can be true or false. a) ~p . q . ~rWrite two different techniques to declare and initialize a variable with an example.(C++) Note:kindly send handwritten material.Use C++ Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes
- Write a program that displays every integer between 1 and 100 that is divisible by 5 or 7, but not both. Write it using While and for.Consider the expression (a && b). Write an equivalent expression (one that evaluates to true at exactly the same values for a and b) without using the && operator.In a triangle, the sum of the lengths of any two sides is greater than the length of the other third side. Write a c++ program that prompts a user to enter the lengths of three sides, check if they form a triangle, and outputs if it is an isosceles, equilateral, scalene, or right triangle where you have to define and use the following functions: (a) isTriangle - takes 3 sides of a triangle and returns true if they form a triangle, false otherwise. (b) isIsosceles-takes3sidesofatriangleandreturnstrueiftheyformanisosceles triangle, false otherwise. (c) isEquilateral - takes 3 sides of a triangle and returns true if they form an equilateral triangle, false otherwise. (d) isRight - takes 3 sides of a triangle and returns true if they form a right triangle, false otherwise. You program should run repeatedly until the user wants to quit.