Line | |
---|
1 | //Author Antonio-Gabriel Sturzu |
---|
2 | |
---|
3 | #include<stdio.h> |
---|
4 | #include<time.h> |
---|
5 | #include<stdlib.h> |
---|
6 | |
---|
7 | int main() |
---|
8 | { |
---|
9 | int i,j,n; |
---|
10 | FILE *f=fopen("dijkstra.in","w"); |
---|
11 | |
---|
12 | /* initialize random seed */ |
---|
13 | srand(time(NULL)); |
---|
14 | printf("Dati valoarea lui n "); |
---|
15 | scanf("%i",&n); |
---|
16 | fprintf(f,"%i\n",n); |
---|
17 | |
---|
18 | for(i=0;i<n;i++) |
---|
19 | { |
---|
20 | for(j=0;j<n;j++) |
---|
21 | { |
---|
22 | if(i==j) |
---|
23 | fprintf(f,"%c ",'0'); |
---|
24 | else |
---|
25 | fprintf(f,"%i ",(rand()%100)+1); |
---|
26 | } |
---|
27 | fprintf(f,"%s","\n"); |
---|
28 | } |
---|
29 | fclose(f); |
---|
30 | return 0; |
---|
31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.