FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of that size using the specified character. 2. Write a function that takes the radius of a sphere as a parameter and returns its volume. 3. Write a function that takes a numberas parameter and returns the factorial. 4. Write a function that takes an integer as parameter and returns thenumber of digits. 5. Write a function that takes an integer as parameter and returns thesum of digits 6. Write a function that takesan integer as parameter and returns thereverse number. 7. Write a function that takes two numbersas parameters and returns their HCF. 8. Write a function that takes two numbersas parameters and returns their LCM. 9. Write a function that checks if a number isprime or not. If the number is prime the function returns true, otherwise false. Also try functions for checking perfect numbers and pallindromes. 10. Write a function that sorts an array of numbers. In the main function, first create and print the unsorted array, then use the function to sort the array, then print the sorted array. 11. Write a function that returns the minimum, maximum and the average value of an arraypassed as a parameter. 12. Write a function that takes a string as parameter and returns the number of words in that string. 13. Write a function that takes a string as a parameter, changes all the letters to uppercase letters and returns the updated string. 14. Write a function that takes an IUB student ID as a string parameter, then checks if the ID is valid. F the ID is valid the function returns true, otherwise it returns false. 15. Write a function that returns the answer to life the universe and everything. 1. Create a 5 x 3 integer array. Fill it with random numbers between 30 and 50. Print the array. 2. Create two 4 by 3 integer matrices called A and B. Subtract A from B and store the resultant matrix in C. Print A, B and C matrices. 3. Take the size of a matrix, A, from the user. Create the matrix, A, and fill it with user input. Then store the transpose of Ain another matrix B. Print both A and B. 4. Create a 4 by 3 integer matrices called A and a 3 by 2 integer matrix called B. Fill both matrices with random numbers. Multiply A and B and store the resultant matrix in C. Print A, B and C. 5. Count the number of prime numbers in a 2D integer array. 6. Compute the average value of each of the rows of a 15 x 10 floating point array. 7. Convert a 5x7 (2D) integer array to a 1Darray. 8. Convert a 1D array of size 10 to a 2x5 or 5 x 2 (2D) array (make sure no data is lost). 9. Create a 5 x 5 matrix. Compute the sum of the values along the two diagonals. Print the sums separately. 10. Create an 8 x 8 chessboard pattern using the extended ASCII codes. 11. Challenge problem: Create a 7 x 7 magic square using a 2D array. Magic square is a square where the sum of every row and column and diagonal is the same. For example, a 3 x 3 magic square looks like: 276-15 951-15 4 38 15 Y 15 15 15 15 15 12. Challenge problem: Write a Tic-Tac-Toe game where the computer never loses. FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of that size using the specified character. 2. Write a function that takes the radius of a sphere as a parameter and returns its volume. 3. Write a function that takes a numberas parameter and returns the factorial. 4. Write a function that takes an integer as parameter and returns thenumber of digits. 5. Write a function that takes an integer as parameter and returns thesum of digits 6. Write a function that takesan integer as parameter and returns thereverse number. 7. Write a function that takes two numbersas parameters and returns their HCF. 8. Write a function that takes two numbersas parameters and returns their LCM. 9. Write a function that checks if a number isprime or not. If the number is prime the function returns true, otherwise false. Also try functions for checking perfect numbers and pallindromes. 10. Write a function that sorts an array of numbers. In the main function, first create and print the unsorted array, then use the function to sort the array, then print the sorted array. 11. Write a function that returns the minimum, maximum and the average value of an arraypassed as a parameter. 12. Write a function that takes a string as parameter and returns the number of words in that string. 13. Write a function that takes a string as a parameter, changes all the letters to uppercase letters and returns the updated string. 14. Write a function that takes an IUB student ID as a string parameter, then checks if the ID is valid. F the ID is valid the function returns true, otherwise it returns false. 15. Write a function that returns the answer to life the universe and everything. 1. Create a 5 x 3 integer array. Fill it with random numbers between 30 and 50. Print the array. 2. Create two 4 by 3 integer matrices called A and B. Subtract A from B and store the resultant matrix in C. Print A, B and C matrices. 3. Take the size of a matrix, A, from the user. Create the matrix, A, and fill it with user input. Then store the transpose of Ain another matrix B. Print both A and B. 4. Create a 4 by 3 integer matrices called A and a 3 by 2 integer matrix called B. Fill both matrices with random numbers. Multiply A and B and store the resultant matrix in C. Print A, B and C. 5. Count the number of prime numbers in a 2D integer array. 6. Compute the average value of each of the rows of a 15 x 10 floating point array. 7. Convert a 5x7 (2D) integer array to a 1Darray. 8. Convert a 1D array of size 10 to a 2x5 or 5 x 2 (2D) array (make sure no data is lost). 9. Create a 5 x 5 matrix. Compute the sum of the values along the two diagonals. Print the sums separately. 10. Create an 8 x 8 chessboard pattern using the extended ASCII codes. 11. Challenge problem: Create a 7 x 7 magic square using a 2D array. Magic square is a square where the sum of every row and column and diagonal is the same. For example, a 3 x 3 magic square looks like: 276-15 951-15 4 38 15 Y 15 15 15 15 15 12. Challenge problem: Write a Tic-Tac-Toe game where the computer never loses.
Expert Answer:
Answer rating: 100% (QA)
1 Heres a Python function that takes a number and a character as parameters and prints a triangle of that size using the specified character python def printtrianglesize char for i in range1 size 1 pr... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
7.2.6 A financial institution has taken over the business of another company. One of the acquired liabilities is a capital redemption policy that obligates the payment of 1,000,000 by the institution...
-
1. Write a script that generates two random numbers between 1 and 10 and if the numbers match then prints Match Found else prints Different Numbers. You can use $RANDOM to generate the random...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
You are to show the journal entries necessary to record the following items which occured in 2012: (a) May 1 Bought a van on credit from Deedon Garage for 6,000. (b) May 3 A debt of 100 owing from P....
-
The sales manager of a clothing company needs to assign seven salespeople to seven different territories. How many possibilities are there for the assignments?
-
Giving justifications for all your decisions, advise the marketing team at the Hotel Pillowmint on all aspects of online advertising covered in this chapter. Alternatively, conduct the same exercise...
-
1. Nina owns a used car lot. She signs and sends a fax to Seth, a used car wholesaler who has a huge lot of cars in the same city. The fax says, "Confiming our agrmt-I pick any 15 cars fr yr lot-30%...
-
Harrelson Company manufactures pizza sauce through two production departments: Cooking and Canning. In each process, materials and conversion costs are incurred evenly throughout the process. For the...
-
I need help filling out the correct answer.. Jacquie Inc. reports the following annual cost data for its single product. Normal production and sales level 80, 000 units Sales price 58.00 per unit...
-
Utilizing the financial information below for The Cookie Company, complete a budget performance report combining activity and revenue and spending variances like that in Exhibit Please be sure to...
-
Problem1 (22 points) MZW Company uses an ABC system to apply overhead. There are three activity rates Purchasing Machining Other overhead $30 per purchase order $5 per machine hour 60% of direct...
-
(20 points) Two crates are stacked in an elevator car that begins to accelerate in the upwards direction at a constant 1.75 m/s2. The top crate has a mass of 12.0 kg, and the bottom crate has a mass...
-
Question 19 ArrayList - Coding Goal: Given the following ArrayList class, which is an ArrayList with a backingArray and a size variable (the same as your homework), implement the addAll(T[] arr, int...
-
You are given the following data for J Corp for January 2020: Purchases of raw materials on account of 70,000; RM inventory, beginning is 13,000; RM, ending inventory balance is 10,000; Indirect...
-
NUBD Co. is planning to market 300,000 units of Product X. The fixed costs are P600,000 and the variable costs are 60% of the selling price. Compute the selling price per unit if the company expects...
-
A product is sold at $100 and its contribution margin percentage is 20%. It also has a fixed cost of $800,000. What is the breakeven sales revenue?
-
On April 14 of last year Bill Murphy, purchasing manager for TransGas, was concerned about being able to find a supplier who could deliver 5.7 km of large-diameter non-"standard" gas transmission...
-
In the circuit shown in Figure 4, a battery supplies a constant voltage of 40 V, the inductance is 2 H, the resistance is 10, and l(0) = 0. (a) Find l(t). (b) Find the current after 0.1s.
-
Under perfect competition, we found that the economic incidence of a taxi.e. who ends up paying a taxhad nothing to do with statutory incidencei.e. who the law said should pay the tax. A: Suppose the...
-
A: Assume that the production technology uses labor and capital k as inputs, and assume through- out this problem that the firm is currently long run profit maximizing and employing a production...
-
Children, Parents, Baby Booms and Baby Busts: Economists often think of parents and children trading with one another across time. When children are young, parents take care of children; but when...
-
Objective To examine a firms current financing choices and to categorize them into debt (borrowings) and equity and to examine the trade-off between debt and equity for your firm. Key Questions ...
-
Is it possible for the NPV of a project to be positive while the IRR is less than the discount rate? Explain.
-
To analyze a firms existing investments, and to identify differential advantages that explain excess returns on existing investments. Key Questions: 1. What are the firms competitive strengths and...
Study smarter with the SolutionInn App