Question

C++ program Write a program which: 1. Enters data into the 2D array of integers which...

C++ program

Write a program which:

1. Enters data into the 2D array of integers which is 5x5

The data should be entered with an assignment statement using nested for loops that is do not scan in the data.

The data should be:

1 2 4 8 16
1 3 9 27 81
1 4 16 64 256
1 5 25 125 625
1 6 36 216 1296

2. Print out the following using a nested for loop

Row 0: 1 2 4 8 16
Row 1: 1 3 9 27 81
Row 2: 1 4 16 64 256
Row 3: 1 5 25 125 625
Row 4: 1 6 36 216 1296
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
using namespace std;

int main(){
   int arr[5][5];
   for(int i = 0;i<5;i++){
      for(int j = 0;j<5;j++){
         cin>>arr[i][j];
      }
   }
   
   for(int i = 0;i<5;i++){
      cout<<"Row "<<i<<": ";
      for(int j = 0;j<5;j++){
         cout<<arr[i][j]<<"\t";
      }
      cout<<endl;
   }
   
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
C++ program Write a program which: 1. Enters data into the 2D array of integers which...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program to calculate the value of y = x2 for all values of...

    Write a C++ program to calculate the value of y = x2 for all values of x where x = 1, 2, 3, 4, 5. Use nested FOR statement to calculate and display the results as shown on the table below. Compile and run the program then submit the CPP file. x y^2 a^3 a^4 a^5 1 1 1 1 1 2 4 8 16 32 3 9 27 81 243 4 16 64 256 1024 5 25 125 625...

  • Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D...

    Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...

  • Write a C or C++ program A6pc(pp) that accepts one command line argument which is an integer n between 2 and 6 inclusiv...

    Write a C or C++ program A6pc(pp) that accepts one command line argument which is an integer n between 2 and 6 inclusive. Generate a string of 60 random upper case English characters and store them somewhere (e.g. in a char array). Use pthread to create n threads to convert the string into a complementary string (‘A’<->’Z’, ‘B’<->’Y’, ‘C’<->’X’, etc). You should divide this conversion task among the n threads as evenly as possible. Print out the string both before...

  • C++ program 2D array of intergers Initialize the 2-D array of integers detailed below. { 25,...

    C++ program 2D array of intergers Initialize the 2-D array of integers detailed below. { 25, 50,   75, 100, 125 }, { 50, 100, 150, 200, 250}, { 75, 150, 225, 300, 375}, { 100, 200, 300, 400, 500}, { 125, 250, 375, 500, 625 }, Traverse and output array elements for the 2D array above in reverse order. Starting with 625, 500, 375, 250, etc…. Attach Snipping Photo of Source Code and Output below. Directly Access and output 225...

  • Write a C program to print the figure as follows. 5, Write a C program to...

    Write a C program to print the figure as follows. 5, Write a C program to print the figure as follows. 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 4 6 8 10 12 14 16 18 9 12 15 18 21 24 27 16 20 24 28 32 36 25 30 35 40 45 36 42 48 54 49 56 63 64 72 81 1 Tip: use loop.

  • Write a Java program that uses nested for loops to print a multiplication table as shown...

    Write a Java program that uses nested for loops to print a multiplication table as shown below. Make sure to include the table headings and separators as shown. The values in the body of the table should be computed using the values in the heading e.g. row 1 column 3 is 1 times 3. * | 1 2 3 4 5 6 7 8 9 4 | 1| 1 2 3 456 7 8 9 2 | 2 4 6.8...

  • Write a program in C that stores the result of all multiplications between 1 and 9...

    Write a program in C that stores the result of all multiplications between 1 and 9 in a two-dimensional int array and then prints the contents of the array to the screen. Also, write some comments in the code. Example: Expected output: 1 4 6 7 8 8 1 12 14 16 18 4 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 1e 15 20 25 30 35 40...

  • In C++ for 2D Array: Write a program that uses a function that manipulates a 2D...

    In C++ for 2D Array: Write a program that uses a function that manipulates a 2D array of integers as follows: 1. Fill the first row and column in the array with random bits 2. Every subsequent cell should be filled as follows: 1. If the cells that are to the left and top of it are equal, then you should store their sum in it b. Otherwise, your program should store the highest among them. Test your function using...

  • This program is C++ You have just been offered your first big software contract. The scope...

    This program is C++ You have just been offered your first big software contract. The scope of work is to create a tool for grade school students to learn their times tables. In this program, you will create a 10 x 10 grid of times tables as a cheat sheet for the students to learn. This will display the values of the times tables all the way from 1x1 to 10x10. Make use of formatting tools like inserting tabs, setwidth(),...

  • 16. Give a recursive definition of (2 points each) (a) the set of odd positive integers...

    16. Give a recursive definition of (2 points each) (a) the set of odd positive integers (i.e., 1, 3, 5, 7, 9,...). (b) the set of positive integer powers of 4 (i.e. 4, 16, 64, 256, ...) (c) The set of integers f1, -5, 25, -125, 625, ...]

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT