1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mnenie [13.5K]
3 years ago
11

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

++)
Computers and Technology
1 answer:
ludmilkaskok [199]3 years ago
7 0

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;

   }

You might be interested in
Write a program that reads a book (a file in text format), breaks each line into words, strips whitespace and punctuation from t
diamong [38]

Answer:

Following are the code to this question:

file= open('book.txt') #open file

li= {} #define an empty list

for lines in file: # use for loop Split file data into words

   d= lines.lower().strip(' !?').split() #define variable d that Add it to map

   for val in d: #define loop to store data  

       if val not in li: #check value is not in list

           li[val] = 0 #define list and assign value in 0

       li[val] = li[val] + 1 #Sort the book data and add its value  

m = sorted(li.items(),key = lambda x : -x[1]) #sorted value into the m variable  

print(m[:10]) #print value

Output:

please find the attachment.

Explanation:

In the given python code first, we open the file "book.txt", in next line, an empty list is defined, that uses the for loop which can be described as follows:

  • In the for loop is used, that reads the file data, and defines a variable "d", that stores the values into the map.
  • In the next line another loop is used, that check file values, if values are the same type so, it adds values and writes it.  
  • In the last line, m variable is used, that sorts the values and use the slicing to print its value.

4 0
3 years ago
Please help! I don’t know the answer to it :( it’s Fashion marketing
Oxana [17]

Answer:

I believe the answer should be C)

Sorry if it’s wrong,but hope it helps

8 0
3 years ago
Create a simple program of your own using a Loop that counts and displays numbers 1-10.
avanturin [10]

Answer:

I think

Explanation:

you....

8 0
3 years ago
CODING IN C++ URGENT HELP PLEASE
forsale [732]

Answer:

this is hard i thought i knew it wow u have hard stuff in your school

Explanation:

7 0
4 years ago
I’ve been struggling with this for a little of u could help that would be great.
e-lub [12.9K]

Answer:

Whether the game is played on WiFi or Cellular data.

Explanation:

You wouldnt be able to do any of the other choices without some type of internet connection.

6 0
3 years ago
Other questions:
  • This is for the folks that is rude:
    12·1 answer
  • What is a directory server?
    5·1 answer
  • The Occupational Outlook Handbook is published by the Bureau of Labor Statistics.
    14·1 answer
  • Which branch of science helps avoid or minimize stress related injuries at workplace? _____ is a branch of science that aims to
    15·1 answer
  • a ____ is a horizontal or vertical bar that appears when the contents of an area may not be visible completely on the screen.
    15·1 answer
  • What are the names of the 3 main languages used for making websites
    10·1 answer
  • Who created apple and in what year was it created
    9·2 answers
  • PLEASE HELP WILL GIVE BRAINLIEST!!!’
    15·1 answer
  • Find an interesting case on the concept of intellectual property
    14·1 answer
  • What types of activities are ideal for a robot to perform?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!