This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let val = 3 | |
function createAdder(){ | |
function addNumbers(a,b){ | |
let ret = a + b; | |
return ret; | |
} | |
return addNumbers; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function integerSquare(arr){ | |
let j = []; | |
for(var i = 0; i < arr.length; i++){ | |
if(arr[i] > 0 && (arr[i] % 1) === 0){ | |
j.push(arr[i] * arr[i]); | |
} | |
} | |
return j; | |
} | |
integerSquare([2,-8,2.5,14,-8,1.68,4]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum3 (x) { | |
return (y) => { | |
return (z) => { | |
return x + y + z; | |
}; | |
}; | |
} | |
sum3 (1)(2)(3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const count = (str, target) =>{ | |
let count = 0; | |
for(var i = 0; i < str.length; i++){ | |
if(str[i].toLowerCase() === target){ | |
count += 1; | |
} | |
} | |
return count; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Main { | |
public static void main(String[] args) { | |
int year; | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter Year "); | |
year = in.nextInt(); | |
if(year % 4 == 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Main { | |
public static void main(String[] args) { | |
int n1 = 0, n2 = 1, n3, n; | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter no to find fibonacci series "); | |
n = in.nextInt(); | |
System.out.println(n1 + "\n" + n2); | |
for(int i = 2; i < n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Main { | |
public static void main(String[] args) { | |
int n,temp, r, s = 0; | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter Number to check palindrome "); | |
n = in.nextInt(); | |
temp = n; | |
while(n > 0){ | |
r = n % 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function centuryYear(year){ | |
if(year <= 0){ | |
return "O and negative is no allowed ! for a year"; | |
} | |
else if(year <= 100){ | |
return 1; | |
} | |
else if(parseInt(year % 100) == 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int num, result = 0, remainder = 0, temp; | |
printf("Enter Number to check palindrome "); | |
scanf("%d", &num); | |
temp = num; | |
while(num > 0){ | |
remainder = num % 10; | |
result = result * 10 + remainder; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindrome(num){ | |
var temp = num; | |
var sum = 0; | |
var result = 0; | |
while(num > 0){ | |
result = parseInt(num % 10); | |
sum = sum * 10 + result; | |
num = parseInt(num / 10); | |
} |