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 skola;
- import java.util.Scanner;
- /**
- *
- * @author Felix 1
- */
- public class Uppgift87 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner inmatning = new Scanner(System.in);
- int[] fält = new int[10];
- boolean fortsätt = true;
- int tal = 1;
- int i = 0;
- int input;
- while(fortsätt)
- {
- System.out.print("Tal nr " + tal + ": ");
- input = inmatning.nextInt();
- if(input >= 0)
- fält[i] = input;
- else
- break;
- i++;
- tal++;
- }
- for(int x = 0; fält[x] != 0; x++)
- {
- System.out.println(fält[x]);
- }
- }
- }
Add Comment
Please, Sign In to add comment