-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindMaxOne.cpp
More file actions
46 lines (34 loc) · 1017 Bytes
/
findMaxOne.cpp
File metadata and controls
46 lines (34 loc) · 1017 Bytes
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
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[])
{
int i, j, n;
int sayac = 0;
int sonsayac = 0;
int sutun=0;
printf("satir sayisi giriniz: ");
scanf("%d", &n);
int dizi[n][10];
srand(time(NULL));
for(i=0; i<n; i++){
for(j=0; j<10; j++){
dizi[i][j]=rand()%2;
printf("%d\t", dizi[i][j]);
}
printf("\n");
}
for (j=0; j<10;j++){
for(i=0; i<n; i++){
if(dizi[i][j]==1)
sayac++;
}
if(sayac > sonsayac){
sonsayac=sayac;
sutun=j;
}
sayac=0;
}
printf("en fazla 1 % d .inci sutunda ve %d tane var\n",sutun+1, sonsayac);
return 0;
}