//Number -> Day (where typeof Day is string)
// Takes a number from 1-7 and returns day of week, or with other number returns invalid day'
function day_of_week(day)
{
    switch(day)
    {
        case 1: return "Monday";
        case 2: return "Tuesday";
        case 3: return "Wednesday";
        case 4: return "Thursday";
        case 5: return "Friday";
        case 6: return "Saturday";
        case 7: return "Sunday";
        default: return "invalid day";
    }
}
console.log (day_of_week(2))  // Function call

//Number -> prints Day (where typeof Day is string)
// Takes a number from 1-7 and console.prints day of week, or with other number prints ' invalid day'
function day_of_week(day)
{
    switch(day)
    {
        case 1: console.log ("Monday")
            break;
        case 2: console.log ("Tuedsay")
            break;
        case 3: console.log ("Wednesday")
            break;
        case 4: console.log ("Thursday")
            break;
        case 5: console.log ("Friday")
            break;
        case 6: console.log ("Saturday")
            break;
        case 7: console.log ("Sunday")
            break;
        default:console.log ("invalid day")
    }
}day_of_week(20)

// Takes no arg ->  prints integer and (number or string)
//  prints integer and associated ASCII character
function charCodes () {
  var i = 1;
  while (i<=95)
    {
      console.log(i+31, String.fromCharCode(i+31))
      i++;
    } 
   
}
charCodes()






// ======== SCRIPTS
var i = 1;
while (i<=33)
    {
      console.log(i, String.fromCharCode(i+64))
      i++;
    }


for (var i = 0;i <=10;i++)
{
    console.log(i)
}

for (var i = 0;i <=10;i++)
{
    if (i>5)
    {
        break
    }
    console.log(i)
}

for (var i = 0;i <=10;i++)
{
    if (i==5)
    {
        continue;
    }
    console.log(i)
}

for (var i = 0;i <=10;i++)
{
    if (i==5 || i==8)
    {
        continue;
    }
    console.log(i)
}



//  QUIZ=======What do these functions do and how do these functions work?


function xyz()
{
    if (true)
    {
        var x = 5;
        console.log(1);
    }
    else
    {
        x = 6;
        console.log(x);
    }
   
}


function is_integer(a)
{
    if (a === true || a===false)
     {console.log('no');
        }
    else if (typeof(a)=='string')
    {
        console.log('no');
        }
    else if (a%1===0)
    {
        console.log("yes")
        }
    else
    {console.log('no')
        }
}

function add_all(arr)
{
 x = 0
 arr.forEach(function(element)
 {
     x = x+element;
 })
 console.log(x)

}

function convert_temp(degrees)
{
   var type_of_temp = prompt("Is that in F or C?");
   if (type_of_temp == 'F')
   {
       var temp = 5*(degrees-32)/9
       return temp
   }
   else
   {
       var temp = 32 + 9*degrees/5
       return temp
   }   
  
}


function factorial(n)
{
    F = 1
    for (var i = 0;i <=n;i++)
    {
        F = F*(n-i)
        if (i==n-1)
        {
            break;
        }
    }
    return F
}

function factorial(n)
{
    F = 1
    for (var i = 1;i <=n;i++)
    {
        F = F*(i)
        console.log(i,F)
    }
   
}

function factorial(n)
{
    F=1
    for (var i = 1;i <=n;i++)
    {
       
        F = F*(i)
        string = i.toString() + " factorial is " + F.toString()
        console.log(string)
    }
   
}

function convert_to_coins(amount)
{
    while (amount >= 25)
    {
        console.log(25, amount)
        amount = amount-25
    }
   
    while(amount>=10)
    {
        console.log(10, amount)
        amount = amount-10
    }
   
    while(amount>=5)
    {
        console.log(5, amount)
        amount = amount-5
    }
   
    while (amount >= 2)
    {
        console.log(2, amount)
        amount = amount-2

    }
    while(amount>=1)
    {
        console.log(1, amount)
        amount = amount-1
    }
}