Aggiorna test.c

This commit is contained in:
Fransisco Moles 2025-01-05 00:53:27 +01:00
parent bd0893c21f
commit f4f473b949

60
test.c
View file

@ -1,41 +1,39 @@
#include <stdint.h>
#include <gmp.h>
uint64_t fibonacci( void ) { #include <stdio.h>
const int n = 25000; #include <stdlib.h>
uint64_t a = 0, b = 1, c; #include <string.h>
for (int i = 2; i <= n; i++) { /* run this program using the console pauser or add your own getch, system("pause") or input loop */
c = a + b;
a = b;
b = c;
}
return b; int fibonacci(int argc, char *argv[]) {
char c[] = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
for(int a=0;a<100000;a++){
parseH(&c);
parseL(&c);
printf("%s",c);
}
return 0;
} }
char* fibonacci_gmp() { void parseH(char *p){
const int n = 25000; int ln=strlen(p);
static char result[10000]; // Assicurati che sia abbastanza grande per contenere il numero for(int a=0; a<ln; a++){
mpz_t a, b, c; if(p[a]<123 && p[a]>96){
p[a]=p[a]-32;
mpz_init_set_ui(a, 0); }
mpz_init_set_ui(b, 1);
mpz_init(c);
for (int i = 2; i <= n; i++) {
mpz_add(c, a, b);
mpz_set(a, b);
mpz_set(b, c);
} }
mpz_get_str(result, 10, b);
mpz_clear(a);
mpz_clear(b);
mpz_clear(c);
return result;
} }
void parseL(char *p){
int ln=strlen(p);
for(int a=0; a<ln; a++){
if(p[a]<91 && p[a]>64){
p[a]=p[a]+32;
}
}
}