Felanpro

uppgift810

Nov 19th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package skola;
  7. import java.util.Scanner;
  8. /**
  9. *
  10. * @author Felix 1
  11. */
  12. public class Uppgift810 {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. int start = 97;
  19. int antal = 20;
  20. int fortsätt = 1;
  21. Scanner inmatning = new Scanner(System.in);
  22. int x = start;
  23. do
  24. {
  25. for(int n = start; n < start + antal; n++)
  26. {
  27. System.out.println(n + "\t" + (char)n);
  28. x++;
  29. }
  30.  
  31. System.out.println("Vill du skriva ut de nästföljande tecknena?: ");
  32. int svar = inmatning.nextInt();
  33. if(svar > 0)
  34. {
  35. System.out.println("Hur många tecken vill du skriva ut?: ");
  36. svar = inmatning.nextInt();
  37. antal = svar;
  38. start = x;
  39. }
  40. else
  41. fortsätt = -1;
  42. }
  43. while(fortsätt > 0);
  44. }
  45.  
  46. }
  47.  
Add Comment
Please, Sign In to add comment