Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. FILE *f = fopen("file.txt", "w+");
  7. if (f == NULL)
  8. {
  9. printf("Error opening file!\n");
  10. exit(1);
  11. }
  12.  
  13. for(int i = 0; i <= 50000000; i++)
  14. {
  15. fprintf(f, "%i\n", i);
  16. }
  17. fclose(f);
  18.  
  19. return 0;
  20. }
  21.  
  22.  
  23. import java.io.BufferedWriter;
  24. import java.io.FileWriter;
  25. import java.io.File;
  26. import java.io.FileOutputStream;
  27. import java.io.IOException;
  28. import java.io.OutputStreamWriter;
  29. import java.io.Writer;
  30.  
  31. public class HelloWorld {
  32. public static void main(String[] args) {
  33. String text = "Hello world";
  34. BufferedWriter output = null;
  35. try {
  36. File file = new File("example.txt");
  37. output = new BufferedWriter(new FileWriter(file));
  38. for(int i = 0; i <= 50000000; i++){
  39. output.write(i+"\n");
  40. }
  41. } catch ( IOException e ) {
  42. e.printStackTrace();
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement