(C Program only! not C++) Write the code segments as indicated: 1.) Declare a mu
ID: 3819510 • Letter: #
Question
(C Program only! not C++)
Write the code segments as indicated:
1.) Declare a multidimensional array of floating point numbers called balances having three rows and five columns.
2.) Given a 2-by-5 integer matrix called x, write a declaration for an array to store x:
Give x some integer values (arbitrary)
Answer the following questions, based on array x:
3.) How many rows and columns does x have?
rows and columns
4.) How many elements does x have?
5.) Write the names of all the elements in the second row of array x:
6.) Write the names of all the elements in the third column of array x
7.) Write a C code statement that sets the element of x in row 1 and column 2 to zero
Explanation / Answer
For question 1 and 2 see the code:
#include<stdio.h>
int main()
{
float balances[3][5];
int x[2][5];
int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
x[i][j]=1;//arbitary values taking 1
}
return 0;
}
For question 3 answer :----->x has 2 rows and 5 coloumns
For question 4 answer :----->x has total 10 elements
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.