-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzadaci.c
38 lines (37 loc) · 832 Bytes
/
zadaci.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
void unos(int **a, int n){
for(int i = 0; i < n; i++){
for(int j = 0; j <n; j++){
printf("unesite element matrice [%d][%d]\n", i, j);
scanf("%d", &a[i][j]);}
}
}
void pretvori(int **a, int n){
for(int i = 0; i < n; i++){
for(int j = 0; j <n; j++){
if(a[i][j]!=0){
a[i][j]=1;
}
}
}
}
void ispis(int **a, int n){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
printf("%d", a[i][j]);
}
printf("\n");
}
}
int main(){
int n=3;
int **a=malloc(n*sizeof(int));
for(int i = 0; i < n; i++){
a[i]=malloc(sizeof(int));
}
unos(a, n);
ispis(a, n);
pretvori(a, n);
ispis(a, n);
}