-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadv_pointer.c
74 lines (42 loc) · 997 Bytes
/
adv_pointer.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdio.h>
#include <time.h>
int main(){
/*
int mtx[3][4] = {
{3,4,5,6},
{1,2,5,4},
{9,0,4,5},
};
int *p = &mtx[0][0];
int colum = 4;
int row = 3 ;
int i,j;
int sum , all , uni ,num , one ,two;
int max = mtx[0][0];
for(i=0 ; i<row ; i++){
for(j= 0 ; j < colum ; i++){
printf("%d ",*(p + i * colum + j ));
}}
*/
// seed the random number first and set the bonders to the number that we take form user ==> one and two repersetn user number
int one ,two , num,i;
srand(time(0));
printf("Enter the bigest bundery :");
scanf("%d",&one);
printf("Enter the smolst bundery :");
scanf("%d",&two);
for(i=0 ; i<5 ; i++){
num = one+rand()%+(two-one+1);
printf("number is : %d\n",num);
}
/* part one
for(i = 0 ; i< row ; i++){
for(j = 0 ; j < colum ; j++){
sum = *(p + i * colum + j);
// printf("%d ", sum);
all = all + sum ;
} // printf(" %d \n", all);
uni = uni + all ;
}printf("%d", all);
*/
}