timus221

Untitled

Mar 2nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. {
  2. int i = 0;
  3. int nr[32];
  4.  
  5. FILE *plik = fopen("numery.txt", "r"); // otworzenie pliku do odczytu
  6. if (!plik)
  7. {
  8. puts("Brak pliku numery.txt");
  9. return EXIT_FAILURE;
  10. }
  11. while (1)
  12. {
  13. fscanf(plik, "%d\n", &nr[i]);
  14. if (feof(plik) != 0)
  15. break;
  16. printf("%d %d\n", i + 1, nr[i]);
  17. ++i;
  18. }
  19. fclose(plik);
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment