├── ContinousFraction ├── ContinuousFraction.c └── Picture.PNG ├── FileWithNumbers.c ├── MatrixQuadrants ├── MatrixQuadrants.c └── Picture.PNG └── README.md /ContinousFraction/ContinuousFraction.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | float rek(int niza[],int n,int br) { 5 | if(n==1){ return niza[br];} 6 | else if(br==n-1){ 7 | return (float)niza[br]; 8 | } else return niza[br]+ 1.0/rek(niza,n,br+=1); 9 | } 10 | 11 | int main() { 12 | 13 | int n; 14 | int niza[100]; 15 | scanf("%d",&n); 16 | for(int i=0;i 2 | #include 3 | #define MAX 100 4 | 5 | //ne menuvaj! 6 | void wtf() 7 | { 8 | FILE *f = fopen("broevi.txt", "w"); 9 | char c; 10 | while ((c = getchar()) != EOF) 11 | { 12 | fputc(c, f); 13 | } 14 | fclose(f); 15 | } 16 | 17 | int main() 18 | { 19 | wtf(); 20 | 21 | FILE *f1; 22 | f1 = fopen("broevi.txt", "r"); 23 | if (f1 == NULL) 24 | { 25 | printf("ne postoi takov file"); 26 | } 27 | int n; 28 | 29 | while (fscanf(f1, "%d", &n) == 1) 30 | { 31 | 32 | if (n == 0) 33 | { 34 | break; 35 | } 36 | int i, max = -9999, cuvajbroj = 0, broj; 37 | for (i = 0; i < n; i++) 38 | { 39 | fscanf(f1, "%d", &broj); 40 | int kopija = broj; 41 | int svrten = 0; 42 | while (broj != 0) 43 | { 44 | svrten = svrten * 10 + broj % 10; 45 | broj = broj / 10; 46 | } 47 | if (svrten % 10 > max) 48 | { 49 | max = svrten % 10; 50 | cuvajbroj = kopija; 51 | } 52 | } 53 | 54 | printf("%d\n", cuvajbroj); 55 | } 56 | fclose(f1); 57 | } -------------------------------------------------------------------------------- /MatrixQuadrants/MatrixQuadrants.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | int main() 4 | { 5 | 6 | int i, j, n, m; 7 | scanf("%d%d", &n, &m); 8 | int a[n][m]; 9 | for (i = 0; i < n; i++) 10 | { 11 | for (j = 0; j < m; j++) 12 | { 13 | scanf("%d", &a[i][j]); 14 | } 15 | } 16 | 17 | int r, b, c, d; 18 | r = b = c = d = 0; 19 | int x, y; 20 | scanf("%d%d", &x, &y); 21 | for (i = 0; i < n; i++) 22 | { 23 | for (j = 0; j < n; j++) 24 | { 25 | if (i < x && j >= y) 26 | { 27 | r += a[i][j]; 28 | } 29 | if (i < x && j < y) 30 | { 31 | b += a[i][j]; 32 | } 33 | if (i >= x && j < y) 34 | { 35 | c += a[i][j]; 36 | } 37 | if (i >= x && j >= y) 38 | { 39 | d += a[i][j]; 40 | } 41 | } 42 | } 43 | printf("%d %d %d %d", r, b, c, d); 44 | } -------------------------------------------------------------------------------- /MatrixQuadrants/Picture.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrieldim/Structured-programming/e50172556e9671a55f50bf51d38f9e59b1a7c0c5/MatrixQuadrants/Picture.PNG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Structured-programming 2 | Topics: 3 | - Functions 4 | - Recursion 5 | - Files 6 | - Matrices 7 | --------------------------------------------------------------------------------