primo
C
//devuelve la suma de los divisores de n sin contar n
int sumar_divisores_propios(int n){
int divisor = 1;
int suma = 0;
while(divisor <= n / 2){
if(n % divisor == 0){
suma = suma + divisor;
}
divisor++;
}
printf("Suma: %d\n", suma);
return suma;
}
//devuelve true si n es primo
//es primo si divisible solo por el mismo y por uno
bool esPrimo(int n){
bool primo = false;
if(sumar_divisores_propios(n) == 1){
primo = true;
printf("Es primo\n");
}else{
printf("No es primo\n");
}
return primo;
}
//DESCOMPOSICION DE FACTORES PRIMOS
int numero, divisor = 2;
printf("Dime un numero y te muestro su descomposicion en factores primos: ");
scanf("%d", &numero);
printf("%d = ",numero);
while ( numero >= divisor ){
while ( numero % divisor == 0 ) {
printf("%d ",divisor);
numero = numero / divisor;
}
divisor ++;
}
printf("%d",numero);
bool esPrimo(int valor){
bool es = true;
int i = 2;
if(valor <= 1){
es = false;
}
while(i < valor && es){
if(valor % i == 0){
es = false;
}
else{
i++;
}
}
return es;
}
Also in C:
- Title
- c bit access struct
- Category
- C
- Title
- convert string to float c
- Category
- C
- Title
- c print array
- Category
- C
- Title
- insertion sort
- Category
- C
- Title
- windowns 10 allow ping
- Category
- C
- Title
- arduino digital input pins
- Category
- C
- Title
- primo
- Category
- C
- Title
- slug urls django
- Category
- C
- Title
- how to create an array of char in c++
- Category
- C
- Title
- c if int
- Category
- C
- Title
- disable gnu++11 option
- Category
- C
- Title
- diagonales
- Category
- C
- Title
- 233 pounds to inr
- Category
- C
- Title
- ModuleNotFoundError: No module named 'easydict'
- Category
- C
- Title
- how to change the mapping from jkil to wasd in vim
- Category
- C
- Title
- v
- Category
- C
- Title
- c program to find the sum of given number
- Category
- C
- Title
- confirm sweet alert
- Category
- C
- Title
- pasar a binario recursivo
- Category
- C
- Title
- arduino knn
- Category
- C
- Title
- docker logs follow
- Category
- C
- Title
- program using if statement in c whether numnber is less eqaul to greater than 50
- Category
- C
- Title
- slurm array job
- Category
- C
- Title
- qtableview get selected row
- Category
- C
- Title
- hentai clochette
- Category
- C
- Title
- diferencia entre * y & en c
- Category
- C
- Title
- Gemfile.lock`. It is likely that you need to grant write permissions for that path.
- Category
- C
- Title
- fa fa-facebook
- Category
- C
- Title
- matplotlib plot circle marker
- Category
- C
- Title
- es palindromo
- Category
- C
- Title
- Declaring Variables in C
- Category
- C
- Title
- atoi
- Category
- C
- Title
- mostrar lista recursiva
- Category
- C
- Title
- delete docker image repository none
- Category
- C
- Title
- printf("%3d ",XX);
- Category
- C
- Title
- triangulo
- Category
- C
- Title
- how to ascii art in c
- Category
- C
- Title
- printf n characters c
- Category
- C
- Title
- conda windows 10 from pip._internal.cli.main import main ModuleNotFoundError
- Category
- C
- Title
- hostbuilder add environment variables
- Category
- C
- Title
- how to globally initlailize a struct
- Category
- C
- Title
- msdos
- Category
- C
- Title
- print integer to stdout using write or putchar?
- Category
- C
- Title
- function in c
- Category
- C
- Title
- kadane's algorithm
- Category
- C
- Title
- code wars responsable drinker
- Category
- C
- Title
- how to pass an array value to a pthread in c
- Category
- C
- Title
- uninstall elgg from hostgtor
- Category
- C
- Title
- matrix c declaration
- Category
- C
- Title
- c copy string
- Category
- C
- Title
- 1 212 32123 4321234 543212345 in c
- Category
- C
- Title
- tkinter create_line
- Category
- C
- Title
- how to get user input in c
- Category
- C
- Title
- error: ‘istringstream’ is not a member of ‘std’
- Category
- C
- Title
- get a remote branch git
- Category
- C
- Title
- Docker error Error response from daemon: conflict: unable to remove repository reference
- Category
- C
- Title
- what is size_t in c
- Category
- C
- Title
- update ubuntu in terminal
- Category
- C
- Title
- how to put a char into a string c
- Category
- C
- Title
- arduino define
- Category
- C
- Title
- factors using recursion
- Category
- C
- Title
- first person view unity
- Category
- C
- Title
- download file by command line windows
- Category
- C
- Title
- reset c array to zero
- Category
- C
- Title
- how to only show tenths place in c
- Category
- C
- Title
- for loop c
- Category
- C
- Title
- c fill 2d array
- Category
- C
- Title
- c producer consumer pthread semaphore
- Category
- C
- Title
- div
- Category
- C
- Title
- restapi
- Category
- C
- Title
- measure time in c
- Category
- C
- Title
- full screen on c
- Category
- C
- Title
- uint32_t extract first bits
- Category
- C
- Title
- c bit access union
- Category
- C
- Title
- last element from list javascript
- Category
- C
- Title
- pointer parameter where to put the asterix in C?
- Category
- C
- Title
- c struct
- Category
- C
- Title
- download android ndk r 16
- Category
- C
- Title
- d3 box shadow
- Category
- C
- Title
- declare character array statically?
- Category
- C
- Title
- bubble sort time complexity
- Category
- C
- Title
- sdl bouton
- Category
- C
- Title
- left me on read
- Category
- C
- Title
- print in c
- Category
- C
- Title
- how to comment in arduino
- Category
- C
- Title
- sustituir un dígito por otro
- Category
- C
- Title
- excel cell blank or zero
- Category
- C
- Title
- command line arguments c
- Category
- C
- Title
- doubly linked list c
- Category
- C
- Title
- c
- Category
- C
- Title
- vbnet create and write on file
- Category
- C
- Title
- root in C
- Category
- C
- Title
- c print hello world
- Category
- C
- Title
- how to download file in powershell
- Category
- C
- Title
- c how to define a variable
- Category
- C
- Title
- powershell list big files
- Category
- C
- Title
- c program to find the sum of given number using recursion
- Category
- C
- Title
- c array
- Category
- C
- Title
- functions in c
- Category
- C
- Title
- check if string in string c
- Category
- C