Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class array
- {
- public static void main(String[] arg) throws IOException
- {
- int[] arr;
- arr = new int[5];
- arr[0] = 1;
- arr[1] = 1;
- arr[2] = 3;
- arr[3] = 3;
- arr[4] = 7;
- int sum = arr[0]+arr[1]+arr[2]+arr[3]+arr[4];
- String svar = FåInput ("Vil du bruge chancen?");
- if (svar.equalsIgnoreCase("ja"))
- {
- System.out.println("Du har valgt chancen.");
- System.out.println("Du får " +sum+ " point.");
- }
- }
- public static String FåInput( String text ) throws IOException
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- System.out.println(text);
- return( reader.readLine() );
- }
- }
Add Comment
Please, Sign In to add comment