Skip to content

Instantly share code, notes, and snippets.

View Ts-Pytham's full-sized avatar
🏠
Working from home

Johan Sánchez Ts-Pytham

🏠
Working from home
  • On my way...
View GitHub Profile
@Ts-Pytham
Ts-Pytham / Serie de Fibonacci.py
Last active September 17, 2019 03:14
Sucesión de Fibonacci en C++/Python
prim = 1
ant = 0
c = "*"
d = 0
r = int(input("Ingrese el rango a terminar para la sucesión de Fibonacci."))
for i in range(0,r):
if d >=1 and d<=4:
c+="*"
else:
d = 0
@Ts-Pytham
Ts-Pytham / numeros_primos.cpp
Created September 17, 2019 03:28
Números primos en C++
#include <iostream>
#include <cstdint>
/*
Algoritmo para imprimir números primos.
Creado por Johan Sánchez, 16/09/2019
*/
#define input(a) std::cin>>a;
int main(){
uint64_t x, primos = 0;
@Ts-Pytham
Ts-Pytham / factorial.py
Created September 18, 2019 03:27
Sacar factorial en Python
a = int(input("Ingrese el numero:"))
factorial = 1
for i in range(1, a+1):
factorial = factorial*i
print(f"{i}! --> {factorial}")
@Ts-Pytham
Ts-Pytham / ReplaceALL.CS
Last active April 13, 2020 03:41
ReplaceALL and RemoveALL C# By Ts-Pytham
using System;
namespace ReplaceALL
{
class Program
{
static string ReplaceAll(string str, string palabra_reemplazar, string palabra)
{
string aux = "", aux1 = "";
int len = str.Length, correcto = palabra_reemplazar.Length, j = 0;
@Ts-Pytham
Ts-Pytham / Fibonacci.cs
Created December 22, 2020 19:27
Sucesión de Fibonacci
using System;
using System.Numerics;
namespace Serie_de_Fibonacci
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Ingrese la posición para hallar el número de la sucesión de Fibonacci: ");
@Ts-Pytham
Ts-Pytham / Palindroma.cs
Created January 11, 2021 23:00
Función que calcula las palabras palíndromas
static bool Palindroma(string palabra)
{
palabra = palabra.Replace(" ", "");
palabra = palabra.ToLower();
int len = palabra.Length;
for(int i = 0; i != len - 1; ++i)
{
if (palabra[i] != palabra[len - 1])
return false;
len--;
@Ts-Pytham
Ts-Pytham / Main.cpp
Created January 22, 2021 04:36
Algoritmo Congruencial Aditivo
#include <iostream>
#include "Random.hpp"
int main()
{
int* vect = new int[5];
for (int i = 0; i != 5; ++i) {
std::cin >> vect[i];
@Ts-Pytham
Ts-Pytham / Main.cpp
Created January 22, 2021 04:50
Algoritmo Congruencial aditivo en C++ usando la clase vector
#include <iostream>
#include "Random.hpp"
#include <vector>
using std::vector;
int main()
{
vector<int> vect;
int data;
for (int i = 0; i != 5; ++i) {
@Ts-Pytham
Ts-Pytham / partial_sum.c
Created April 17, 2023 05:10
Partial sum with pipes and fork
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <time.h>
#include <signal.h>
#define TABLE_SIZE 10000
struct timespec start, end;
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
void *handler;
void funcHandler(int sig)