mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-12-08 00:45:29 +01:00
refactor(solutions): headers file in C
This commit is contained in:
parent
953323781c
commit
0893aac35d
@ -1,5 +1,5 @@
|
|||||||
#ifndef CHARACTER_H
|
#ifndef __CHARACTER__
|
||||||
#define CHARACTER_H
|
#define __CHARACTER__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a character to a string, assuming string points to an array
|
* @brief Append a character to a string, assuming string points to an array
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef INPUT_H
|
#ifndef __INPUT__
|
||||||
#define INPUT_H
|
#define __INPUT__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read a line from stdin.
|
* @brief Read a line from stdin.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef STRING_H
|
#ifndef __STRING__
|
||||||
#define STRING_H
|
#define __STRING__
|
||||||
|
|
||||||
#define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
#define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef CHARACTER_H
|
#ifndef __CHARACTER__
|
||||||
#define CHARACTER_H
|
#define __CHARACTER__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a character to a string, assuming string points to an array
|
* @brief Append a character to a string, assuming string points to an array
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef INPUT_H
|
#ifndef __INPUT__
|
||||||
#define INPUT_H
|
#define __INPUT__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read a line from stdin.
|
* @brief Read a line from stdin.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef STRING_H
|
#ifndef __STRING__
|
||||||
#define STRING_H
|
#define __STRING__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes all whitespace from the start of a string.
|
* @brief Removes all whitespace from the start of a string.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef CHARACTER_H
|
#ifndef __CHARACTER__
|
||||||
#define CHARACTER_H
|
#define __CHARACTER__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Append a character to a string, assuming string points to an array
|
* @brief Append a character to a string, assuming string points to an array
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef INPUT_H
|
#ifndef __INPUT__
|
||||||
#define INPUT_H
|
#define __INPUT__
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read a line from stdin.
|
* @brief Read a line from stdin.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef STRING_H
|
#ifndef __STRING__
|
||||||
#define STRING_H
|
#define __STRING__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ int* prime_numbers_decomposition(int number, int* decomposition_length) {
|
|||||||
int dividend = number;
|
int dividend = number;
|
||||||
while (total != number) {
|
while (total != number) {
|
||||||
int divider = 2;
|
int divider = 2;
|
||||||
int reste = 0;
|
int remainder = 0;
|
||||||
int quotient = 0;
|
int quotient = 0;
|
||||||
do {
|
do {
|
||||||
reste = dividend % divider;
|
remainder = dividend % divider;
|
||||||
quotient = dividend / divider;
|
quotient = dividend / divider;
|
||||||
divider++;
|
divider++;
|
||||||
} while (reste != 0);
|
} while (remainder != 0);
|
||||||
divider--;
|
divider--;
|
||||||
decomposition[*decomposition_length - 1] = divider;
|
decomposition[*decomposition_length - 1] = divider;
|
||||||
*decomposition_length = *decomposition_length + 1;
|
*decomposition_length = *decomposition_length + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user