Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. float min(float a, int n);
  4. float max(float a, float b);
  5. float T();
  6.  
  7. const int NMax = 100;
  8.  
  9. int main()
  10. {
  11. int n;
  12. float a[NMax], b[NMax], c[NMax];
  13. FILE* file;
  14. fopen_s(&file, "in.txt", "r");
  15. fscanf_s(file, "%d", &n);
  16.  
  17. for (int i = 0; i < n; i++)
  18. fscanf_s(file, "%f", &a[i]);
  19.  
  20. for (int i = 0; i < n; i++)
  21. fscanf_s(file, "%f", &b[i]);
  22.  
  23. for (int i = 0; i < n; i++)
  24. fscanf_s(file, "%f", &c[i]);
  25.  
  26. fclose(file);
  27. }
  28.  
  29. float min(float* a, int n)
  30. {
  31. float m = a[0];
  32. for (int i = 1; i < n; i++)
  33. if (a[i] < m)
  34. m = a[i];
  35. return m;
  36. }
  37.  
  38. float max(float* a, int n)
  39. {
  40. float m = a[0];
  41. for (int i = 1; i < n; i++)
  42. if (a[i] > m)
  43. m = a[i];
  44. return m;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement