#include <iostream.h>

#include <string.h>

#include <math.h>

#include <stdlib.h>

#include <iomanip>

using namespace std;

#define MAX 5

void mulmatvec(int m, int n, double a[MAX][MAX], double x[MAX], double b[MAX]){

int i,j;

for(i = 0; i < m; i++){

b[i] = 0.;

for(j = 0; j < n; j++)

b[i] += a[MAX][MAX]*x[j];

}

return;

}

int main(){

int i,j=5,m=5,n=5;

double x[MAX], b[MAX];

double a[MAX][MAX]=

{{0.900,0.100,0.000,0.000,

{0.000,0.400,0.600,0.000,0

{0.000,0.600,0.300,0.100,0

{0.000,0.000,0.000,0.000,1

{0.000,0.150,0.000,0.850,0

cout << "Enter the vector\n";

for(j = 0; j < n; j++)

cin >> x[j];

mulmatvec(m,n,a,x,b);

cout << "\nA*x = \n";

for(i = 0; i < m; i++)

cout << b[i]<< "\n";

return 0;

}