Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Es9 {
- public static void main(String[] args) {
- int[] ordine1 = new int[5];
- int[] ordine2 = new int[5];
- Scanner kb = new Scanner(System.in);
- for (int i=0;i<ordine1.length;i++) {
- ordine1[i] = kb.nextInt();
- }
- System.out.println("ordine 1 preso");
- for (int i=0; i<ordine2.length;i++) {
- ordine2[i] = kb.nextInt();
- }
- System.out.println("ordine 2 preso");
- combinaOrdini(ordine1, ordine2, kb);
- System.out.println("totale ordini: ");
- for (int i=0; i<tot.length; i++) {
- System.out.println((i+1) + ": " + tot[i]);
- }
- }
- public static int[] combinaOrdini(int[] ordine1, int[] ordine2, Scanner kb) {
- int[] tot = new int[5];
- for (int i = 0; i<tot.length;i++) {
- tot[i] = ordine1[i]+ordine2[i];
- }
- return tot;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment