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
-
Discuss the mechanisms of epigenetic regulation, particularly the roles of DNA methylation and histone modification in controlling gene expression. How might aberrations in these processes lead to...
-
Write short answers of the following questions. 1. Describe Laravel MVC Framework Structure in your own words. 2. What are Grid classes in the Bootstrap? Explain jumbotron and list group in Bootstrap...
-
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
-
1. Use the data of Problem 5-14B to prepare Hilton Building Supplies' multi-step income statement for the year ended July 31, 2014. In problem 5-14B Selected accounts of Hilton Building Supplies, at...
-
Estimate the number of molecules in a typical automobile tire. Estimate the number of atoms?
-
How to organize litigation files for trial?
-
The MacBurger Company, a chain of fast-food restaurants, expects to earn $200 million after taxes for the current year. The company has a policy of paying out half of its net after-tax income to the...
-
Financial statement analysis Liabilities Current liabilities Accounts payable Accrued liabilities and other Deferred revenue Resale value guarantees Customer deposits Current portion of debt and...
-
NOTE: include a copy of your equations and equations/code with your plots 1. (50 points) A non-afterburning turbojet is being designed for operation at an altitude of 15 km and a Mach number of 1.8....
-
Consider a thunderstorm with a flash of lightning followed by acrash of thunder. The time delay between the lightning flash andthe sound of the thunder is 5.0 seconds. The intensitylevel of the sound...
-
12) Multiply on a clock: 54 13) Compute 37 mod 7
-
Calculate savings, MPC, MPS, break-even income, and the equilibrium level of income (Y = AE = C + I + G +NX) in the below given information. Draw a graph showing disposable income (Yd) on the...
-
How would I explain and teach my patient about the pathophysiology of autism using non-medical terminology?
-
Prove using induction that the solution of the recurrence T(n) = = 5 if n = 1, 3T(n-1)-4 if n > 1 is T(n) 3+2 for n 1.
-
Find the domain of the rational function. x +4 f(x) x2 + 9x
-
Advika is leasing a car originally valued at $42,200. The lease is being financed with an interest rate of 8.69% compounded monthly with Payments of $416 at the beginning of each month. How many...
-
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...
-
Ski resorts are interested in the mean age that children take their first ski and snowboard lessons. They need this information to plan their ski classes optimally. identify: a. the population, b....
-
Insurance companies are interested in the mean health costs each year of their clients, so that they can determine the costs of health insurance. identify: a. the population, b. the sample, c. the...
-
A fitness center is interested in the mean amount of time a client exercises in the center each week. identify: a. the population, b. the sample, c. the parameter, d. the statistic, e. the variable,...
Study smarter with the SolutionInn App