| postevanka.c | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <stdio.h>
#include<string.h>
main() {
FILE *izhod;
int N, i;
char imeDat[20];
printf("Vpisi stevilo: ");scanf("%d",&N);
sprintf(imeDat, "postevanka-%d.txt", N);
if ((izhod=fopen(imeDat, "w")) != NULL) {
for (i=1; i<10; i++)
fprintf(izhod, "%d\n", i*N);
fclose(izhod);
} else
printf("Napaka pri odpiranju datoteke %s\n", imeDat);
}
|