Advertisement
Felanpro

övning86

Nov 19th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 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.  
  8. /**
  9. *
  10. * @author Felix 1
  11. */
  12. public class Övning86 {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. double folkmängd = 1000000;
  19. int år = 0;
  20.  
  21. while(folkmängd < 2000000)
  22. {
  23. folkmängd = folkmängd * 1.05;
  24. år++;
  25. }
  26.  
  27. System.out.println("Det tar " + år + " år");
  28. }
  29.  
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement