Skip to content
Snippets Groups Projects
Commit 64df4402 authored by Muhammad Rizki Fonna's avatar Muhammad Rizki Fonna
Browse files

Tambah output ke txt

parent 3c5b4684
Branches
No related merge requests found
......@@ -5,6 +5,10 @@
#include <omp.h>
#include <time.h>
//void keluaran(int* mat[], int b, int k);
int main()
{
int N;
......@@ -13,7 +17,7 @@ int main()
srand(13516001);
#pragma omp parallel for num_threads(10)
#pragma omp parallel for num_threads(10)
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
......@@ -48,6 +52,26 @@ int main()
printf("Elemen baris %d, kolom %d : %d\n", i, j, mat[i][j]);
}
}
//keluaran(mat, N, N);
FILE* fp;
fp = fopen("file.txt", "w");
//int i, j;
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
if (j == N - 1)
{
fprintf(fp, "%d\n", mat[i][j]);
}
else
{
fprintf(fp, "%d ", mat[i][j]);
}
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment