Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:
🥇LaLa

elixirdada

:electron:
🥇LaLa
View GitHub Profile
@elixirdada
elixirdada / calcChecksum.rb
Created Nov 5, 2018 — forked from devninja67/calcChecksum.rb
This Ruby file includes Ruby functions that Luhn algorithm is implemented. checkLuhn1 returns value if current barcode(including check digit) validates. checkLuhn2 returns value that current barcode join its checkdigit as suffix.
View calcChecksum.rb
def sumLuhn (barcode, nParity)
checksum = 0
for i in 0..barcode.length - 1
nDigit = barcode[i].to_i
if nParity == i % 2
nDigit = nDigit * 2
end
checksum = checksum + nDigit / 10 + nDigit % 10
end
return checksum % 10
@elixirdada
elixirdada / division_bignumber.c
Created Nov 5, 2018 — forked from devninja67/division_bignumber.c
This application is C console application that substraction, division and remainder between two bigNumbers is implemented.
View division_bignumber.c
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef signed short int_least16_t;
// swapping two charaters
void swap( char* a, char* b ) {
char p = *a;
*a = *b;