2. Using cyclomatic complexity test the following program code (White Box Testing). Int b=40; If a=50 If a>b Print a; Print b; Else End if; End if; Print none;
Q: 1) Guessing Game in Matlab . When the program starts, a random whole number , n , is selected…
A: The answer to all the questions are given below with codes and output screenshot
Q: Loops, C++ Write a program that takes in a line of text as input, and outputs that line of text in…
A: 1. Taking a variable text of string type. 2. declaring i variable for iterations. 3. getline is used…
Q: C++ Demonstration: Write a program that computes the equivalent resistance of a purely series and…
A: Introduction C++ Demonstration: Write a program that computes the equivalent resistance of a purely…
Q: REQUIREMENT USE A SWITCH STATEMENT SELECTION STRUCTURE Write a logically correct Java switch…
A: The above question is solved in step 2 :-
Q: The following statement should determine if x is not greater than 20. What is wrong with it?
A: Answer: Given statement error is highlighted with red font if (!x>20)
Q: Turbo C programming if (X>20&&90) - - - Line 1 { if (X>50) { printf("Who? "); } else {…
A: && is the logical AND operator. It returns true only when both the operands return true…
Q: Problem Statement Create a program that will determine whether a triple can generate a triangle and…
A: The python program is given below:
Q: Example-6 A number of rivers (N), each river has three (pH) values. Write a program to read the (pH)…
A: Include all the required headers in the answer program. Declare the main function. Declare the…
Q: All of the following are examples of nesting control structure EXCEPT: OHaving a loop inside an if…
A: The answer of the given question is mentioned below: -
Q: Guessing Game in Matlab . When the program starts, a random whole number , n , is selected where…
A: Algorithm: Start Generate a random whole number in the range 1-200 and store it in r Initialize n…
Q: pseudocode If X = 2, Y = 4, and Z = 6, which of the following will give a result of False? (X…
A: Given X = 2, Y = 4, and Z = 6
Q: Logical table: Write the truth value of the following logical statements X=17; Y=35 Question;…
A: Find the truth values using following details: X=17; Y=35Question;!(Y!=X | | (X<Y)(Y==X)…
Q: Allowed languages C Problem Statement Given four points of the form: x1,y1,x2,y2,x3, y3,x4,y4 -…
A: //C program #include <stdio.h> int main() { int n,x1,x2,x3,x4,y1,y2,y3,y4;…
Q: Problem Description The hailstone sequence is defined as the integer sequence that results from…
A: Python programming language : Python is a programming language that Guido van Rossum created in the…
Q: C++ - When analyzing data sets, such as data for human heights or for human weights, a common step…
A: Step 1:- Program Approach:- (i)Declare one header file (ii)Declare 3 variable of type integer…
Q: a. x floor (7.5); 0. x = fabs (0.0); %3D C. x cei1 (0.0); d. x = fabs (-6.4); e. x cei1(-fabs (-8 +…
A: import…
Q: Write an algorithm that computes the Body Mass Index (BMI) given the heights and weights of…
A: Given : Write an algorithm that computes the Body Mass Index (BMI) given the heights and weights of…
Q: Programming Language: C++ Develop a Tic Tac Toe game that will match a player against the computer.…
A: #include<bits/stdc++.h> using namespace std; #define COMPUTER 1 #define HUMAN 2 #define…
Q: using c++ Write a program that computes and displays the charges for a patient's hospital stay.…
A: #include <iostream>#include <iomanip>#include <fstream>using namespace std;double…
Q: Problem 2: Employee Payment The Stark Industry needs a program to calculate how much to pay their…
A: Java program to calculate the employees payment. The name of the class is StarkIndustry. Create a…
Q: Compute the weakest precondition for each of the following statements based on their postconditions.…
A: There is conditional statement given in this image.
Q: The following section of code assigns the indicated values to a bool: bool a; int w = 10, x = 15, y…
A: Below is the answer with explanation:
Q: this is c program Write program that ask the user to enter int mark (0-100) for test Physics. Then…
A: Your C program is given below as you required with an output.
Q: Part 3: Looping while(x<y) { If(z<0){ x=x+a; } Else{ x=x+z; z= -z } x=x+1; }…
A: The while loop is a fundamental control structure in programming that allows a block of code to be…
Q: Python Language Useful websites: : http://en.wikipedia.org/wiki/Radix…
A: Task :- Write a Python function to find the kth digit for given number. Python program :- def…
Q: 1-Compute the weakest precondition for the following statements A. x = 2* (y + 2*x); y=3*x-6 {y > 9}…
A: Complete answer is given below:
Q: The athlete is given two attempts to shoot. The highest score counts. From the list of attempts, get…
A: #include <bits/stdc++.h>using namespace std; int main() { int number_of_atheletes=0; //…
Q: Identify whether the program is a counter-controlled repetition or sentinel-controlled repetition…
A: counter controlled loop is controlled by a counter value, at each iteration counter value will…
Q: The correct declaration statement is: int X; Y; int X, Y; int X, Y int X,…
A: Rules for declaring statement. 1) Every statement must be end with semicolon (;) 2) if we are…
Q: Task using C language Two spacecrafts are traveling at different speeds from Earth to Mars. While…
A: Dear Student, The source code, implementation and expected output of your question is given below -
Q: Q7-Write a program that simulates a simple calculator. It reads two integers and a character. If the…
A: // Always mention the language of the program, for now, I am doing it in C++ // Code #include…
Q: ) Guessing Game in Matlab . When the program starts, a random whole number , n , is selected…
A: The answer to the following question:-
Q: Compare Numbers - Python Language please! Programming challenge description: Little Tommy is in…
A: Step 1 : STARTStep 2 : implement the function compare_numbersStep 3 : input 2 numbersStep 4 : store…
Q: Interest on a credit card's unpaid balance is calculated using the average daily balance. Suppose…
A: To write program to find interest. i used C++ language.
Q: The following section of code assigns the indicated values to a bool: bool a; int w = 10, x = 15, y…
A: Please find the answer below :
Q: Q1. FizzBuzz problem:- Write a program which return "fizz" if the number is a multiplier of 3,…
A: The FizzBuzz problem is a classic programming task, often used in coding interviews. It tests your…
Q: Change the program above to add the numbers 157 and 13. (Hint: these numbers are constants and…
A: Mail box Mnemonic code Numeric code Instruction 00 IN 901 ;input 1st number 01 STO 99 399…
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 program that reads a positive integer x from the user. If x is even, the program prints all…
A: logic:- declare x do { read positive number if x<0 display error message } while (x<0); if…
Q: # Write a detailed description of what this program does. The write-up should include: # 1) A single…
A: The program given above is written in a python programming language. This language is most widely…
Q: Part 4 Guessing game (random and absolute) Write a program that does this: You (as programmer) are…
A: random function:- The built-in C++ STL function rand() is defined in the header file…
Q: Study the following if statement: if x>10 or x1000000: print('very big') elif x<-1000000:…
A: Control structures are used to determine the path of execution and control the execution of…
Q: A business law class of 25 students takes a midterm exam that has 100 true- or-false questions. The…
A: We need four arrays in this problem. The array KOUNT stores the number of times a grade is achieved…
Q: Part 2b: Password Verification A secure password is critically important in today's world.…
A: Sample Response: /*program that will accept as input a potential password and determine whether or…
Q: Develop a body mass index (BMI) caleultor program that reads body weight and height as inputs and…
A: The complete C program is shown below. Sample Response: //C program#include<stdio.h>//main…
Step by step
Solved in 2 steps with 2 images
- Problem Statement Write a program that reads three positive integers (>0)from the command line (one at a time), then computes and prints the smallest entered number. Use if-else statements for three integer comparison. Assuming that the use always enter a valid positive integer. Example 1: Enter an integer: 5 Enter an integer: 23 Enter an integer: 7 The smallest number is: 5 Example 2: Enter an integer: 3 Enter an integer: 3 Enter an integer: 6 The smallest number is: 3 Partial Solution Please try to implement the full source code in your IDE first. The solution is partially provided below. Fill in the blanks to complete the missing parts and make sure to not add an empty space before and after the answer. #include using namespace std; int main() ( //decare three Intergersvariables Int first, second, third, smallest; //prompt and get user inputs cout> first cout> second cout> third //find the smallest number [Select] second) [Select] (first [Select] third) X smallest [Select] Jelse if…C PROGRAM 1. Rewrite this code so that it will use a single if-statement only if ( x < 1 ) {printf (“hello!”);}if ( x > 10 ) {printf (“hello!”);} 2. Rewrite this code so that it will use a single if-statement only: if ( x < 1 ) {printf (“hello!”);}if ( x > 10 ) {printf (“hello!”);}4) Roll the dice 2 Make a program that tests the probability of a certain score when rolling x dice. The user should be able to choose to roll eg 4 dice and test the probability of a selected score eg 11. The program should then do a number of simulations and answer how big the probability is for the selected score with as many dice selected. There must be error checks so that you cannot enter incorrect sums, for example, it is not possible to get the sum 3 if you roll 4 dice. TarningsKast2 How many dices do you want to throw? 11 Which number do you want the probability for? The probability the get the number 11 with 4 dices is 7.19% Calculate
- Problem Description The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers. Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well. Input A line containing two integers separated by a space. 6·9 Output A line containing an integer. 3Fundamentals of Programming in C Language Write the value of each of the following expressions, using the following data declarations: double m = 17.5; int y = 9; 1. (m > 12.0) && (y / 2 <= 4) 2. (y % 3 != 0) 3. (m < 2 * y) 4. (2 == 3) || (m - 16 >= 0)C language Q4. Write a program that asks the user to enter an integer n, then prints the first n multiple of n. The program should keep asking to enter a number until -1 is entered. (0.5 point) Q5: a. What does the following program print? char c='Z'; for(i=1;i<= 4; i++) { for(j= 1; j<= i; j++) { printf("%c", C--); } printf("\n"); } b. Re-write the above code using while loop. Output: Sample Output: Enter a number: 4 48 12 16 Enter a number: 6 6 12 18 24 30 36 Enter a number: 1 1 Enter a number: -1 End Using while loop: (2x0.5 =1 point)
- Correct the following if statement below.#include <stdio.h>int main(void){int volt_1=12;if(volt_1 < 10);{printf("This prints inside the if function \n");}printf("This prints outside the if function \n");}C++ please - 24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since midnight. The day starts at 0000, and ends at 2359. Write a program that converts am/pm time to 24-hour time. If the input is 2:30 pm, the output should be 1430. If the input is 12:01 am, the output should be 0001. Hints: Think of how each hour should be handled. 12:00 am -12:59 am becomes what? 8:00 am becomes what? 12:00 pm? 1:00 pm? Group the hours into cases that should be handled similarly (e.g., 1:00 am to 11:00 am are handled the same). Declare variables for hoursAmPm, minAmPm, and hours24. Note that minutes for 24-hour time remain the same as for am/pm, so no extra variable is needed. Use an if-else statement to detect each case, and set the hours24 appropriately. When outputting hour24, check if the hour is 0-9 (just check for < 10). If so, output a "0". So 7 will be output as 07. Do the same when outputting the minutes. #include…*Modify the program so that the user will error trap for only 1 and 0 as an input. *If the user enters an input other than 1 or 0 display an error message and request the user enter that input again. *Do this for all inputs in the code. # User defined function for logic OR# The function takes two parameters and returns a single intdef OR(a: int, b: int)->int:# If a is equal to 1 return 1if a == 1 :return 1# If b is equal to 1 return 1elif b == 1 :return 1# If a and b is equal to 0 return 0else :return 0 # User defined function for logic NOR# The function takes two parameters and returns a single intdef NOR(a: int, b: int)->int:# If a is equal to 0 and b is also equal to 0 return 1if a == 0 and b == 0 :return 1# If a is equal to 0 and b is equal to 1 return 0elif a == 0 and b == 1 :return 0# If a is equal to 1 and b is also equal to 0 return 0elif a == 1 and b == 0 :return 0# If a is equal to 1 and b is also equal to 1 return 0elif a == 1 and b == 1 :return 0 # User defined…