Small fixes

This commit is contained in:
Abreu 2021-10-23 18:02:32 -03:00
parent 6e5d01fb9c
commit 5cf049704f
No known key found for this signature in database
GPG Key ID: 64835466FF55F7E1
2 changed files with 5 additions and 6 deletions

View File

@ -7,10 +7,10 @@ bool isPrime (int num) {
if (num < 2)
return false;
for(i = 3; i < sqrt(num); i++)
for(i = 3; i < sqrt(num); i += 2)
if(num % i == 0)
return false;
return 0;
return true;
}
void countProducts() {
@ -23,7 +23,7 @@ void countProducts() {
else
np++;
}
if((n1 == p && n2 == np) || n1 + n2 == p || n1 + n2 == np)
if ((n1 == p && n2 == np) || n1 + n2 == p || n1 + n2 == np)
printf("ROGeRIO POH DEIXAR ESSX AQUI ENTRAR QUE TA LIMPO\n");
else if (p == np && np == 0)
printf("vei sem nada neah? vai gasta moh grana ai dentro\n");
@ -33,7 +33,7 @@ void countProducts() {
}
int main(){
int n;
int n = 0;
for(scanf(" %d", &n); n > 0; n--)
countProducts();

View File

@ -34,12 +34,11 @@ bool isRepeated (char **words, int i, int size) {
int countRepetitions (char **words, int size) {
int i, repetitions = 0;
for (i = 0; i < size - 1; i++) {
for (i = 0; i < size; i++) {
if (isRepeated(words, i, size))
repetitions++;
free(words[i]);
}
free(words);
return repetitions;
}