Seudónimo Seudónimo
  • 16-12-2020
  • Computers and Technology
contestada

Given a MxN matrix.Print the elements in odd rows from left to right and the elements in even rows from right to left.(Java or C++)

Respuesta :

shazamzeus21 shazamzeus21
  • 16-12-2020

given the array arr[][]:

 bool leftToRight = true;

 for (int i=0; i<M; i++)

   {

       if (leftToRight)

       {

           for (int j=0; j<N; j++)

               printf("%d ", arr[i][j]);

       }

       else

       {

           for (int j=N-1; j>=0; j--)

               printf("%d ",arr[i][j]);

       }

 

       leftToRight = !leftToRight;

   }

Answer Link

Otras preguntas

Questions of fact deal only with events that have already happened. True or False
Find alll the numbers that are divisible by 100
Please write one or two sentences
Problem: A ball is thrown upward and outward from a height of 6 feet. The height of the ball, f(x), in feet, can be modeled by I f(x)=-0.6x2 +2.7 x+6 where x is
i with my family..... to delhi two week ago.(go) english grammer​
A strong counter-argument exhibits which of the following characteristics? A. It uses exaggeration to prove a point. B. It may be offensive. C. It provides evid
write a letter to the princial to requesting to organise an inter-house volleyball tournament in our school​
state the first and second law of thermodynamics​
(PLESE HELP) Factor the following expression. Simplify your answer.5p(p + 2)^-2/3 +4(p +2)^1/3plese explain your answer
Write an article about invention which is tested on animals with 150 words