Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- int N,i;
- FILE *f;
- #ifdef _DEBUG
- N=20;
- #else
- scanf_s("%d", &N);
- #endif
- int *mas = (int *) malloc(sizeof(int)*N);
- for (i=0; i<N; i++) mas[i]=2*i+1;
- fopen_s(&f,"massiv.txt","wt");
- if (f==NULL) {
- printf("Error in file!");
- return -1;
- }
- for (i=0; i<N; i++)
- fprintf(f,"%d\n",mas[i]);
- fclose(f);
- printf("It's OK!\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement