Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0 2 4 6 7
- 8 9 10 11 12
- 0 2 4 2 0
- 8 9 10 9 8
- 0 2 4 2 2
- 8 9 10 8 8
- import java.util.Scanner;
- public class Mirror {
- public static void main (String [] args)
- {
- Scanner kb = new Scanner (System.in);
- System.out.println("Please enter number of rows: ");
- int rows = kb.nextInt();
- System.out.println("Please enter number of columns:");
- int columns = kb.nextInt();
- int [][] mirror = new int [rows][columns];
- int sum =0;
- for (int r = 0; r<mirror.length; r++)
- {
- for (int c = 0; c<mirror[r].length ; c++)
- {
- mirror[r][c]= sum;
- sum= sum+2;
- }
- }
- for (int r = 0; r<mirror.length; r++)
- {
- for (int c = 0; c<mirror[r].length ; c++)
- {
- System.out.print (mirror[r][c]+ " ");
- }
- System.out.println();
- }
- int add = 0;
- for (int r = 0; r<mirror.length; r++)
- {
- for (int c = mirror[r].length/2 +1; c<mirror[r].length ; c++)
- {
- for (int x= 0; x<mirror[r].length/2; x=x++)
- {
- mirror[r][c] = mirror [r][x];
- }
- }
- }
- System.out.println();
- for (int r = 0; r<mirror.length; r++)
- {
- for (int c = 0; c<mirror[r].length ; c++)
- {
- System.out.print (mirror[r][c]+ " ");
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement