Skip to content

Instantly share code, notes, and snippets.

@aryan348
aryan348 / hello.c
Created July 16, 2020 14:58
CS50 Problem Set 1 (Fall 2020) - Hello
#include <stdio.h>
#include <cs50.h>
int main (void)
{
string name = get_string("Whats your name\n");
printf ("Hello, %s\n", name);
}
@aryan348
aryan348 / Mario.c
Last active July 16, 2020 15:15
CS50 Problem Set 1 (Fall 2020) - Mario less
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
// to get height from user
@aryan348
aryan348 / MarioMore.c
Last active July 16, 2020 15:15
CS50 Problem Set 1 (Fall 2020) - Mario More
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
n = get_int("Height: ");
@aryan348
aryan348 / Cash.c
Last active July 16, 2020 15:17
CS50 Problem Set 1 (Fall 2020) - Cash
#include <math.h>
#include <cs50.h>
#include <stdio.h>
int main(void)
{
float d;
do
{
@aryan348
aryan348 / Readability.c
Created July 16, 2020 15:10
CS50 Problem Set 2 (Fall 2020) - Readability
#include <math.h>
#include <cs50.h>
#include <stdio.h>
int main(void)
{
float d;
do
{
@aryan348
aryan348 / Caesar.c
Created July 16, 2020 15:11
CS50 Problem Set 2 (Fall 2020) - Caesar
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
// function declaration
int encrypt(int k);
int main(int argc, string argv[])
@aryan348
aryan348 / Plurality.c
Created July 16, 2020 15:13
CS50 Problem Set 3 (Fall 2020) - Plurality
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max number of candidates
#define MAX 9
// Candidates have name and vote count
typedef struct
{
@aryan348
aryan348 / credit.c
Created July 18, 2020 19:41
CS50 Problem Set 1 (Fall 2020) - Credit
#include <math.h>
#include <cs50.h>
#include <stdio.h>
// Function Declaration
int creditCardType(long cardNumber);
int main(void)
{
@aryan348
aryan348 / runoff.c
Created July 29, 2020 14:45
CS50 Runoff Problem Set 3
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
// Max voters and candidates
#define MAX_VOTERS 100
#define MAX_CANDIDATES 9
// preferences[i][j] is jth preference for voter i