Skip to content

Commit

Permalink
Training stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeterd committed Dec 3, 2020
1 parent 9470ddc commit e0b53ed
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
Binary file added CodeEasy/aver-prob
Binary file not shown.
33 changes: 33 additions & 0 deletions CodeEasy/aver-prob.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>

#define MAX 1000

int main(int argc, char const *argv[]){

for(int i=1; i<MAX; i++){
for(int j=1; j<MAX; j++){
double cont = (1+1+5+i+j)/5;
if(cont == 4){
printf("Number: %d %d\n", i, j);
printf("Product: %d\n", (j*i*5));
}
}
}

return 0;
}

/* x x x x x
Media = 4
Moda = 1
Mediano = 5
Logo sabemos que o valor do meio é 5, entao:
x x 5 x x
Sabemos tambem que 1 é moda ou seja aparece 2 ou 3 vezes o valor 1
1 1 5 x x ou 1 1 5 1 x
*/
Binary file added CodeEasy/one-th
Binary file not shown.
36 changes: 36 additions & 0 deletions CodeEasy/one-thounsand.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>

#define MAX 1000

int verfy(int x, int arr[]){
if(arr[x] != 0)
return 0;
else
return 1;
}

int main(int argc, char const *argv[]){

int i,j;
int cont=0;
int arr[MAX+1];

for(i=1; i<=MAX; i++){
arr[i] = 0;
}

for(i=1; i<=MAX; i++){
for(j=1; j<=MAX; j++){
if(i+j == MAX && verfy(i,arr) && verfy(j,arr)){
arr[i] = arr[j] = 1;
printf("%d + %d = %d\n", i, j, (i+j));
cont++;
}
}

}
printf("%d\n", cont);

return 0;
}

0 comments on commit e0b53ed

Please sign in to comment.