Write a C program that 1. writes an n x n matrix into a file named...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a C program that 1. writes an n x n matrix into a file named matrix.txt, the matrix has to contain random values, n has to be given by the user 2. contains a function with the name squareM, which input parameters are the matrix and the size of the matrix, and returns with 1 if the main diagonal contains only zeros and 0 if not 3. calls the square function on that random matrix, and displays the result on the screen For example: Input Result 12 15 1 000 7 88 456 0 3 2 01 10 TL 1 Write a C program that 1. writes an n x n matrix into a file named matrix.txt, the matrix has to contain random values, n has to be given by the user 2. contains a function with the name squareM, which input parameters are the matrix and the size of the matrix, and returns with 1 if the main diagonal contains only zeros and 0 if not 3. calls the square function on that random matrix, and displays the result on the screen For example: Input Result 12 15 1 000 7 88 456 0 3 2 01 10 TL 1
Expert Answer:
Answer rating: 100% (QA)
include include include void writeMatrixToFileint n FILE fp fp fopenmatrixtxt w if fp NULL printfError opening file exit1 Create the random matrix int matrixnn srandtimeNULL for int i 0 i n i for int ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Please do the following Matlab problem, 1.Write a for loop ranging from 3 to 5. In the loop, print the value of the loop index to the screen using fprintf in the following format: Value is n where n...
-
Pooling agreements have been outlawed in all states. True/false
-
Two point charges, Q1 = -6.7μC and Q2 = 1.8μC are located between two oppositely charged parallel plates, as shown in Fig. 16-65. The two charges are separated by a distance of x = 0.34. Assume...
-
A sample of 20 items provides a sample standard deviation of 5. a. Compute the 90% confidence interval estimate of the population variance. b. Compute the 95% confidence interval estimate of the...
-
On October 1, 2017, Gordon borrows \($150\),000 cash from a bank by signing a three-year installment note bearing 10% interest. The note requires equal payments of \($60\),316 each year on September...
-
Sydney Company had retained earnings of $56,000 and total stockholders equity of $75,000 at the beginning of 20X1. During 20X1 the company had net income of $21,000, declared and paid cash dividends...
-
1) For the system in the diagram m2=2.0 kg m3=3.0 kg 0=30 k=0.10 s=0.12. Find m1 and its tension for the following m3 m2 72 a) m1 accelerates upward with a=1.2 m/s^2 m1 m1= T= b) m1 moves upward with...
-
At the end of the day the clerk for Wales Variety Shop noticed an error in the amount of cash he should have. Total cash sales from the sales tape were $1,204, whereas the total cash in the register...
-
Mcdonald's company sells inventory .on January 1, 2023 mc sols to buyer limited a machine with a list price of $60,000.The cost of the inventory was $29,000. Mc collected $10,000 cash (downpayment0...
-
Prior to the investment progressing, further research has been undertaken and it has been identified that the market for the product is uncertain and is affected by the reaction from competitors....
-
Weston Industries is considering the following independent projects for the coming year: Project Required Investment Expected Rate of Return Risk X $3 million 10.5% High Y 3 million 9.5% Average Z 7...
-
You want to have $10 million dollars when you retire in 45 years.How much do you have to invest each month if you can earn 13% annual return (compounded monthly) on your investment?
-
How would you use derivative securities to achieve each of the following objectives? Explain. (a) You have stocks in a trust account that you cannot sell for a year; afterwards you will have full...
-
Could you conduct an analysis of the prevailing trends impacting Quality and Safety Professionals within the realm of healthcare administration?
-
The road development authority is evaluating the costs and benefits of three alternative routes for a mountain road that will connect a previously inaccessible community with the nearest town. This...
-
If the joint cost function for two products is C(x, y) = xy2 + 1 dollars (a) Find the marginal cost (function) with respect to x. (b) Find the marginal cost with respect to y.
-
Carl Conch and Mary Duval are married and file a joint return. They live at 1234 Mallory Sq. Apt. 64, Key West, FL 33040. Carl works for the Key Lime Pie Company and Mary is a homemaker after losing...
-
During 2012, Tom sold Sears stock for $10,000. The stock was purchased 4 years ago for $13,000. Tom also sold Ford Motor Company bonds for $35,000. The bonds were purchased 2 months ago for $30,000....
-
Please answer the following questions regarding the taxability of Social Security: a. A 68-year-old taxpayer has $20,000 in Social Security income and $100,000 in tax-free municipal bond income. Does...
-
Reconsider Problem 18. Management has decided that the $5 million raised through stock should be split between common stock and preferred stock. Common stock will be used to raise $3,000,000 and...
-
Repeat Problem 23 assuming that the stock price is growing at 3 percent per year. Data from problem 23 Lahoma Enterprises, Inc., needs $15 million to finance a major product development. The project...
-
Repeat Problem 23 assuming the stock offering will be preferred stock rather than common stock. The preferred stock will sell for $120/share, pay a $9 annual dividend, and have a cost of selling of...
Study smarter with the SolutionInn App