Skip to content

Instantly share code, notes, and snippets.

#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height;
do
{
height = get_int("Height:");
#include <cs50.h>
#include <stdio.h>
int result;
int get_positive_int(string prompt)
{
do
{
result = get_int("%s", prompt);
#include <cs50.h>
#include <stdio.h>
# define NUM_DAYS 5
int main(void)
{
int hours[NUM_DAYS];
// write a for loop to prompt for the number of hours for each day
#include <cs50.h>
#include <stdio.h>
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("You need to provide the name in the command line.\n");
return 1;
#include <cs50.h>
#include <stdio.h>
int main(int argc, string argv[])
{
if (argc != 3)
{
printf("Usage: ./exit <firstname> <lastname>\n");
return 1;
}
#include <cs50.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// get a string named plaintext
string plaintext = get_string("plaintext: ");
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#define BASE 2
// returns true if binary, false if not binary
bool check_binary(int b)
{
while (b > 0)
#include<stdio.h>
#include<cs50.h>
#include "multiplication.h"
int main(void)
{
//To Do: Write a function to prompt the user for numberA and numberB
int A = get_int(":");
int B = get_int(":");
//To Do: Write a function to return the product of numberA and numberB. "The product of the number is: "
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc != 2)
#include <cs50.h>
#include <stdio.h>
#define NUMBERS_ON_CARD 24
// function prototype
bool linear_search(int arr[], int n, int size);
// Numbers on bingo card
int bingo_card[] = {7, 14, 4, 9, 6, 26, 22, 24, 20, 28, 40, 34, 36, 35, 58, 55, 46, 52, 49, 73, 68, 72, 74, 64};