Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of that size using the specified

FUNCTION 1. Write a function that takes a number and a character (as parameters) and prints a triangle of1. Create a 5 x 3 integer array. Fill it with random numbers between 30 and 50. Print the array. 2. Create

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.

Step by Step Solution

3.44 Rating (170 Votes )

There are 3 Steps involved in it

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

538453257, 978-0538453257

More Books

Students also viewed these Programming questions

Question

Define personality and list the big five personality traits.

Answered: 1 week ago