Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <malloc.h>
- #include <math.h>
- const int Mx = 1005;
- int n;
- float dt, arr[1005];
- int main()
- {
- FILE *fr = fopen("input.txt", "r");
- FILE *fw = fopen("output.txt", "w");
- if (fr == NULL)
- {
- fprintf (fw, "Invalid input");
- }
- fread (arr, sizeof(float), n, fr);
- if (n < 0 || n >= 1000 || dt <= 0 || dt >= 0.1)
- {
- fprintf (fw, "Invalid input");
- }
- else
- {
- float *arr = malloc(sizeof(float)*n);
- for (int i = 0; i < n; i++) {
- arr[i] = sinf(i * dt);
- }
- for (int i = n - 1; i >= 0; i--) {
- fprintf (fw, "%.4f", arr[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement