**4.19 (Compute the perimeter of a triangle) Write a program that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid. The input is valid if the sum of every pair of two edges is greater than the remaining edge. Here is a sample run: Enter three edges: 1, 1, 1 The perimeter is 3 JEnter Enter three edges: 1, 3, 1 The input is invalid Enter
Q: 2. Write a printf or scanf statement for each of the following: e) Read characters into array s…
A: The problem is based on taking the input from the user until the given condition is not satisfied.
Q: 3. Use a trace table to show what is the output of the following program? #include using namespace…
A: As per the policy we are required to answer only one question.Solution for question 3 is as…
Q: 11. Write code that reproduces the output shown below. In [11]: # Code Here In [12]: # DON'T WRITE…
A: In this question we have to write a python code to generate a array using numpy. Question 11. Write…
Q: Print the following List in the reversed order using lambda / arrow operator. var array = new List…
A: Print the following List in the reversed order using lambda / arrow operator. var array = new List…
Q: Convert to binary - methods Write a program that takes in a positive integer as input, and outputs a…
A: import java.util.Scanner; public class LabProgram // the class { // user define…
Q: 2. Given the same initial statements s1 = [2,1,4,3] s2 = ['c','a','b'] show the values of s1 and s2…
A: The problem is based on the basics of lists in python programming language.
Q: 28.1 program Write a function void reverse(int a[ ], int size) to reverse the elements in array a,…
A: I give the code in C along with output and code screenshot
Q: 5. Write a JS program to get the largest even number from an array of integers.
A: Write a JS program to get the largest even number from an array of integers. Algorithm: Create a…
Q: 7. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent…
A: Note: As you have asked multiple part questions, as per our policy, we will solve the first three…
Q: 18 - What is the output of the following code?
A: The output of the following code is - Good Luck good luck
Q: 10 - In an examination, 500 students appeared. Out of these students, 38 % got A+ grade, 45 % got B+…
A: Program to find the number of students who got A+, B+ and the number of students who just passed.
Q: HW5-4) Write and test a function that fetches the next n characters from input (including blanks,…
A: Answer
Q: .13 Define a method named swapValues that takes an array of four integers as a parameter, swaps…
A: Java code to swap elements at index 0 and 1, 2, and 3 are given below with an output. Algorithm:…
Q: int i, j; for(i=3, j=4 ; i>10; --i,j--) { } printf("%d and %d", i, j);
A:
Q: 44) Assume int A[3][3] = {{2,3,4},{5,6,7}, (8,9,1}}; // to print the secondary diagonal elements we…
A: In the given question, we have a 3X3 array that is an array with three rows and three columns and we…
Q: 1-Write a C++ program to input elements in array and sort array elements in descending order. How…
A: CODE-: /****************************************************************************** Welcome to…
Q: PYTHON CODE: In order to beat AlphaZero, Grandmaster Hikaru is improving her chess calculation…
A: Required: In order to beat AlphaZero, Grandmaster Hikaru is improving her chess calculation…
Q: C++ Problem Statement Holi is celebrated in India as a festival of colours and your friend Khan from…
A: Algorithm: Firstly take the input for the number of test cases then take the value for number of…
Q: 27. Implement the following RECURSIVE function named starString: // Returns a string containing 2^n…
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the function…
Q: Q5 (a) What is the data type of pointer variables? Suppose that we don't know the name of a variable…
A: 1) Pointer datatype Pointer is a variable in that holds the address of another variable. They have…
Q: 6. Write a C++ program to check whether the sequence of the numbers in a given array is a…
A: I give the code in c++ along with output screenshot and code screenshot
Q: Define a method named swapValues that takes an array of four integers as a parameter, swaps array…
A: import java.util.Scanner; public class LabProgram { public static void swapValues(int[]…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: C++ #include<iostream..h> #include<conio.h> void main() { int Year; cout<<"Enter…
Q: 2. Write the following program: If the last digit of your unique real Kean ID is even, implement a…
A: Algorithm: Start Using System.nanoTime() finding begin time at the start of the program Read ID…
Q: 1. Using C++, Implement the following using C++ arrays and Classes. find the Mean, Median, Mode,…
A: According to the information given:- We have to find mean , median, mode, standard deviation and…
Q: 3. Write C++ statements to define and initialize the following arrays. a. Array heights of 10…
A: array declaration and initialization in c++ syntax is data_type…
Q: The word limit for this explanation is 350.
A: Final variable: ==>In general we represent a variable as final variable using "final" keyword.…
Q: Printing array elements separated by commas. Write a for loop to print all NUM_VALS elements of…
A: The given below program is in java
Q: 1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some…
A: Program code: //include the required header files #include<iostream> //std using namespace…
Q: Assume bool foundPair and int pairCount are both declared and have valid values. if (foundPair)…
A: Here foundPair is boolean variable so it can hold either true or false value. The if statement in…
Q: 7.17) Write the inOrder() method, which has an array of integers as a parameter, and returns true…
A: Given: Write the inOrder() method, which has an array of integers as a parameter, and returns true…
Q: 1. Proof the following statement: I a) Let x E R. If x > 0, then x² + 2 > 0 b) Suppose n € Z. If n²…
A: Answer
Q: Question 3
A: Writing the program code in java as in the given question no programming language is specified.This…
Q: PYTHON CODE: In order to beat AlphaZero, Grandmaster Hikaru is improving her chess calculation…
A: Required: In order to beat AlphaZero, Grandmaster Hikaru is improving her chess calculation…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + + 10e-10x) *…
A: The answer is false, because the above mentioned code generates the following error.
Q: 1 äböi In the following program, the output value is (3). #include void main( ) { int…
A: Answer: When we run the given program it will give the output 3 #include <iostream> using…
Q: Q5. (a) Write a program to input a list of numbers in an array and then rearrange this array in such…
A: Introduction of the Program: The C program takes the size of the array from the user and then the…
Q: What does the following program print? #include using std::cout; using std::endl; int main() {…
A: Use <iostream> besides include command to run code properly in C++.
Q: 7. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent…
A: Implementation of Complex numbers ADT in C++ using a class Complex: #include<iostream>using…
Q: f the following actions correspond to SDN
A: Option B: All routers in the network send information about their incoming and outgoing links to a…
Q: vi) In C++, rotate the array given below to left by 2 places and print it in the output. int A[6] =…
A: Write a C++ program to rotate the array given below to left by 2 places and print it in the output.…
Q: а1.1. Write a NumPy program to get the following array by using loops Output: array([[ 1, 2, 3, 4,…
A: Note: Answering the first three subparts as per the guidelines. The question is about the usage of…
Q: 14.11 LAB: Drawing a right side up triangle Write a recursive function called draw_triangle) that…
A: n = int(input())print("\n") countSpace = 0countStar = 1 while True: for space in range(0, n -…
Q: 18. A former secretary has left her job and decided to sell textbooks. Assume the book is sold at…
A: Given: We are given that former secretary has left her job and she has decided to sell textbooks.…
Q: Write a C++ program that reads an integer maxAllowed and in output prints all elements less than the…
A: Given: An array of integers containing 10 integers. int Array[10] = {67, 49, 11, 90, 123, 98, 8,…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + ..• + 10e-10x) *…
A: Task : The task is to check whether the given code implements that series whose value is equal to…
Q: 4. b. If A is an array of integers with width = 4; Please translate with three-address statement,…
A: In 3 address instrument format, one opcode and 3 address field is required.
You will select one of the problems below and create a program that uses nested selections to solve the problem.
Do not use Boolean operators.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- Python 3.7.4 Given that add, a function that expects two int parameters and returns their sum, and given that two variables, euro_sales and asia_sales, have already been defined: Write a statement that calls add to compute the sum of euro_sales and asia_sales and that associates this value with a variable named eurasia_sales.5.21 In Python: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise.def is_leap_year(user_year)Part 2: Binary Arithmetic One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly. Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together: 0 + 0 0 + 1 1 + 0 1 + 1 0 1 1 10 (remember that 10 in binary represents the number 2) In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all…
- 13.16.1: Overload salutation printing. Complete the second PrintSalutation function to print the following given personName "Holly" and customSalutation "Welcome":Welcome, Holly End with a newline. #include <iostream>#include <string>using namespace std; void PrintSalutation(string personName) { cout << "Hello, " << personName << endl;} // Define void PrintSalutation(string personName, string customSalutation)... /* Your solution goes here */ int main() { PrintSalutation("Holly", "Welcome"); PrintSalutation("Sanjiv"); return 0;}21.7 LAB: Login name (Use python) Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first five letters of the last name, followed by the first letter of the first name, and then the last two digits of the number (use the % operator). If the last name has less than five letters, then use all letters of the last name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: JordaM91 Ex: If the input is: Kanye West 2024 the output is: Your login name: WestK24**11.18** Java Solve (ArrayList of Character) Using the following header, create a method that produces an array list of characters from a string: toCharacterArray public static ArrayListCharacter> (String s) ToCharacterArray("abc"), for example, returns an array list containing the characters 'a', 'b', and 'c'.
- 10.25 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and computes the two results of the quadratic formula: x1=−b+b2−4ac2a x2=−b−b2−4ac2a The quadratic_formula() function returns the tuple (x1, x2). Ex: When a = 1, b = -5, and c = 6, quadratic_formula() returns (3, 2). Code provided in main.py reads a single input line containing values for a, b, and c, separated by spaces. Each input is converted to a float and passed to the quadratic_formula() function. Ex: If the input is: 2 -3 -77 the output is: Solutions to 2x^2 + -3x + -77 = 0 x1 = 7 x2 = -5.504.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH5.28 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 Your program must define and call the following two functions. The IntegerToReverseBinary() function should return a string of 1's and 0's representing the integer in binary (in reverse). The ReverseString() function should return a string representing the input string in reverse. string IntegerToReverseBinary(int integerValue)string ReverseString(string userString)
- 1(a): Implement the following C function : concatenate the lowest byte of each of two integers. The output should have 0's in the two most significant bytes , followed by the least significant byte of the first then second argument . For example , concatLowBytes (0x12345678 , 0xaabbccdd) 0x000078dd . You may use hexidecimal constants of any size. You should not use binary notation , function calls , loops or conditional statements. Examples : concatLowBytes ( 0x00000011 , 0x00000022)=0x00001122 concatLowBytes (0x12345678 , 0xaabbccdd )= 0x000078dd int concatLowBytes (int x, int y){ }7.24 LAB: Convert to binary-functions Write a program that takes in a positive integer as input, and outputs a string of 1's and O's representing the integer in binary. For an integer x, the algorithm is As long as x is greater than 0 Output x 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string Ex: If the input is the output is: 110 The program must define and call the following two functions. Define a function named int to reverse_binary() that takes an integer as a parameter and returns a string of 1's and O's representing the integer in binary (in reverse). Define a function named string reverse() that takes an input string as a parameter and returns a string representing the input string in reverse. def int_to_reverse_binary(integer_value) def string reverse(input_string) LAB ACTIVITY 7.24.1: LAB. Convert to binary-functions 0/10 1 # Define your functions here. 2…Q#2 Write a recursive function zeroCount ( int a[ ], int s, int e) that receives an array of integers a [], a start index s, and an end index e. The function should return the number of zeros in that array between s and e. int zeroCount ( int a[ ], int s, int e); Trace your function given the following array and function call. Draw your steps. int a[ ] = {1, 0, 0, 5}; int zeros = zeroCount(a, 0, 3); language c++