Create a matrix of order 4x3 in program that prompt user his roll no: then multiply 2023 with that created matrix then print it on the screen.
CODE:
#include <iostream>
using namespace std;
int main()
{
int a[4][3],b[4][3];
cout<<"Enter single digit of your roll number : ";
for (int i=0;i<4;i++)
{
for (int j=0;j<3;j++)
{
cin>>a[i][j];
}
}
for (int i=0;i<4;i++)
{
for (int j=0;j<3;j++)
{
b[i][j]=a[i][j]*2023;
}
}
cout<<"The matrix of 4x3 after multiplication with 2023 is "<<endl;
for (int i=0;i<4;i++)
{
for (int j=0;j<3;j++)
{
cout<<b[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
RESULT:
Comments
Post a Comment