Answer:
#include <iostream>
using namespace std;
int main() {
int a[4][5];//declaring a matrix of 4 rows and 5 columns.
for(int i=0;i<4;i++)
{
for(int j=0;j<5;j++)
{
if(i==3)//initializing last row as 0.
{
a[i][j]=0;
}
else//initializing last row as 1.
{
a[i][j]=1;
}
}
}
for(int i=0;i<4;i++)
{
for(int j=0;j<5;j++)
cout<<a[i][j]<<" ";//printing the matrix.
cout<<endl;
}
return 0;
}
Output:-
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 0 0 0 0
Explanation:
I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.
Plagiarism is a crime, flat out. It is unethical and immoral to copy, verbatim, another persons work and claim it as your own, especially for scholastic uses. In order to avoid plagiarism, it is important that we give accurate references and paraphrase, rather that copy and paste information. It is important to consider the widespread effect of plagiarism. It effects all involved: The student, the owner of the information, the instructor, and even the site from which the information was stolen. Use the proper channels and be honest when completing assignments goes a long way. We must do what we can to prevent plagiarism, starting with ourselves and our own research. <span />
Answer:
Please see the attached picture for the complete answer.
Explanation: