Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package quientoejercicio;
- import javax.swing.*;
- /**
- *
- * @author deiby
- */
- public class QuientoEjercicio {
- static int Vect[][];
- static String Mensaje = "";
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- int n = Integer.parseInt(JOptionPane.showInputDialog(" Introduzca el numero de filas "));
- int Vect[][] = new int[n][3];
- LLenarVector(Vect);
- MostrarVector(Vect);
- }
- public static void LLenarVector(int Vect[][])
- {
- for(int i = 0; i < Vect.length; i++)
- {
- for(int j = 0; j < Vect[i].length-1; j++)
- {
- Vect[i][j] = Integer.parseInt(JOptionPane.showInputDialog(" Introduzca los numeros " + (i) + (j)));
- }
- }
- }
- public static void MostrarVector(int Vect[][])
- {
- for(int i = 0; i < Vect.length; i++)
- {
- for(int j = 0; j < Vect[i].length; j++)
- {
- int Suma = (Vect[i][j] + Vect[i][j]);
- if(Vect[i][2] == 0)
- {
- Vect[i][2] = Suma;
- Mensaje = Mensaje + Vect[i][j] + " + " + Vect[i][j] + " = " + Suma + "\n";
- }
- }
- }
- JOptionPane.showMessageDialog(null,Mensaje);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement