Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import java.io.DataOutputStream;
  2. import java.io.FileOutputStream;
  3.  
  4. public class Zahlen {
  5. public static void main(String[] args) {
  6.  
  7. int n = 50;
  8. try {
  9.  
  10. FileOutputStream f1 = new FileOutputStream("C:/Test/zahlen.txt");
  11.  
  12. for (int i = 1; i <= n; i++) {
  13. int random = (int) ((Math.random() * 100) + 1);
  14. System.out.println(random);
  15. f1.write(random);
  16.  
  17. }
  18.  
  19. f1.flush();
  20. f1.close();
  21.  
  22. } catch (Exception e) {
  23. System.out.println(e.getMessage());
  24. }
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement