Jump to content
  • 0

Помогите пожалуйста с задачей


mauzil
 Share

Question

Помогите найти ошибку.

Получить [ aij ], i = 1, ..., 10; j = 1, ..., 12 - целочисленную матрицу, для которой aij = i + 2j.

var a1 = []

var max_i = 10;

var max_j = 12;

for( var i = 1; i <= max_i; i++ )

{

a1[ i ] = [];

for( var j = 1; j <= max_j; j++ )

a1[ i ][ j ] = i + 2 * i * j;

}

malert( a1 );

var a2 = []

for( var i = 1; i <= max_i; i++ )

{

a2[ i ] = [];

for( var j = 1; j <= max_j; j++ )

if( i < j )

a2[ i ][ j ] = Math.sin( i + j );

else if( i === j )

a2[ i ][ j ] = 1;

else

a2[ i ][ j ] = Math.asin(( i + j ) / ( 2 * i + 3 * j ))

}

malert( a2 );

function malert( a )

{

var s = '';

for( var i = 1; i <= max_i; i++ )

{

for( var j = 1; j <= max_j; j++ )

s += a1[ i ][ j ] + '\t';

s += '\n';

}

alert( s )

}

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy