Skip to content

Instantly share code, notes, and snippets.

@ashraf267
ashraf267 / ing-word-check.dart
Created January 23, 2023 23:26
This dart code checks if a given word ends with 'ing' (return true) or not (return false)
void main() {
// todo
print("Hello World!");
HighEngine firstWord = HighEngine(word: 'engine');
print(firstWord.word);
print(firstWord.checkWord());
// sandbox
@ashraf267
ashraf267 / 9-fizz_buzz.c
Created September 17, 2022 00:45
Modern problems, modern solutions :)
#include <stdio.h>
int main() {
void print(int n);
int i;
for (i = 1; i <= 100; i++) {
if (i % 15 == 0) {
putchar('F');
@ashraf267
ashraf267 / magic.js
Created July 11, 2022 23:06
Thank God!
let input = require('sync-input');
console.log("Welcome to Currency Converter!");
console.log(`1 USD equals 1 USD
1 USD equals 113.5 JPY
1 USD equals 0.89 EUR
1 USD equals 74.36 RUB
1 USD equals 0.75 GBP`);
(function myCurrConv() {
@ashraf267
ashraf267 / doings.js
Created July 7, 2022 22:41
Another style for the currency converter (v2)
let currencies = [
{
name: "JPY",
val: 113.5,
},
{
name: "EUR",
val: 0.89,
},
{
@ashraf267
ashraf267 / newSolution.js
Created July 4, 2022 12:56
Second version of the Currency Converter that worked.
let input = require('sync-input');
console.log("Welcome to Currency Converter!");
console.log(`1 USD equals 1 USD
1 USD equals 113.5 JPY
1 USD equals 0.89 EUR
1 USD equals 74.36 RUB
1 USD equals 0.75 GBP`);
console.log("What do you want to convert?");
let fromCurrency = "USD";
let toCurrency = "EUR";
let amount = 89;
let result = "";
if(fromCurrency == "USD") {
// for USD
let usdRates = {
usd: 1,
jpy: 113.5,
@ashraf267
ashraf267 / work.js
Created July 2, 2022 10:37
work in progress solution.
let input = require('sync-input');
console.log("Welcome to Currency Converter!");
console.log(`1 USD equals 1 USD
1 USD equals 113.5 JPY
1 USD equals 0.89 EUR
1 USD equals 74.36 RUB
1 USD equals 0.75 GBP`);
console.log("What do you want to convert?");
@ashraf267
ashraf267 / search-arr.js
Created July 1, 2022 15:47
custom JS code to search through an array
let colors = ["red", "green", "blue", "yellow"];
let favColor = "pink";
(function check() {
let output = 0;
for(color in colors) {
// console.log(colors[color]);
if(colors[color] == favColor) {
output = "I found your favorite color, color " + colors[color];
@ashraf267
ashraf267 / currency-conv.js
Last active June 25, 2022 13:58
This is the only solution that passed all test. Alhamdulillah! I am proud of this one.
let input = require('sync-input');
console.log("Welcome to Currency Converter!");
console.log(`1 USD equals 1 USD
1 USD equals 113.5 JPY
1 USD equals 0.89 EUR
1 USD equals 74.36 RUB
1 USD equals 0.75 GBP`);
console.log("I can convert USD to these currencies: JPY, EUR, RUB, USD, GBP");
console.log("Type the currency you wish to convert: USD");
// import the readline module
let rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout,
});
console.log("Welcome to Currency Converter!");
console.log(`1 USD equals 1 USD
1 USD equals 113.5 JPY
1 USD equals 0.89 EUR