/CS50x-Psets-Lua

I've written solutions in Lua for some CS50x problems.

Primary LanguageLua

CS50x-Psets-Lua

Credit

A program which takes as input a Credit Card number and determine the provider between , American Express, Mastercard and VISA.

Mario

The program we’ll write will be called mario. And let’s allow the user to decide just how tall the pyramids should be by first prompting them for a positive integer between, say, 1 and 8, inclusive.

$ ./mario
Height: 8
       #  #
      ##  ##
     ###  ###
    ####  ####
   #####  #####
  ######  ######
 #######  #######
########  ########

Population

Determine how long it takes for a population to reach a particular size.

$ ./population
Start size: 100
End size: 200
Years: 9

Plurality

A program that runs a plurality election, per the below.

$ ./plurality Alice Bob Charlie
Number of voters: 4
Vote: Alice
Vote: Bob
Vote: Charlie
Vote: Alice
Alice

readability

A program that calculates the approximate grade level needed to comprehend some text, per the below.

$ ./readability
Text: Congratulations! Today is your day. You're off to Great Places! You're off and away!
Grade 3

Subtitution

A program that implements a substitution cipher, per the below.

$ ./substitution JTREKYAVOGDXPSNCUIZLFBMWHQ
plaintext:  HELLO
ciphertext: VKXXN