Skip to content

Instantly share code, notes, and snippets.

👩‍💻
...

Happiness Nwosu NEbere

👩‍💻
...
Block or report user

Report or block NEbere

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NEbere
NEbere / factorise.js
Created Feb 11, 2016
Factorisation of a digit in javascript
View factorise.js
function factorialize(num) {
//check if num == 0
if (num === 0) {
return 1;
}
//else calculate factorial
return num * factorialize(num - 1);
}
//calling the function. this will return 120
factorialize(5);
@NEbere
NEbere / reverse.js
Created Feb 11, 2016
Reverse a string in vanilla javascript
View reverse.js
function reverseString(str) {
return str.split("").reverse().join("");
}
alert(reverseString("hello"));
@NEbere
NEbere / sum.php
Created Feb 11, 2016
Sum of the integers in a string
View sum.php
<?php
function digitSum($n) {
$array = str_split($n);
$sum = array_sum($array);
print $sum;
}
//calling the function
digitSum("123");
@NEbere
NEbere / factorial.php
Created Feb 11, 2016
The factorial of a given number
View factorial.php
<?php
function factorial($n) {
$factorial = 1;
for($i = $n; $i >= 1; $i--){
$factorial = $factorial * $i;
}
echo "Factorial of $n is $factorial";
}
//calling the function
@NEbere
NEbere / sum.js
Created Feb 2, 2016
Calculates the sum of 1 to 1000, if the number is a multiple of 5 or three,double it and add it to the sum.
View sum.js
$(document).ready(function(){
var sum1= 0, res = 0, totalSum = 0;
for (var x = 1; x <= 1000; x++)
{
if (x % 3 === 0 || x % 5 === 0)
{
k = x * 2;
sum1 += k;
You can’t perform that action at this time.