Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int main(void)
{
printf("This is CS50AP!\n");
}
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int age = get_int("Enter Your Age: ");
// Let's assume my age is 17
printf("Right now I'm %i years old.\n", age);
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// declare a string named "name" and get input with get_string
string name = get_string("Enter Name: ");
// declare an int named "age" and get user input with get_int
int age = get_int("Enter Age: ");
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// declare a string animal and get user input
string animal = get_string("Enter a a type of animal: ");
// declare a celestial body and get input
string body = get_string("Enter a celesial body: ");
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// declare an int variable a and get user input
int a = get_int("Enter a whole number: ");
// declare an int b and assign it the value of a plus 3
int b = a + 3;
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// Get grade as a number
int grade = get_int("Enter your grade: ");
// grades between 90 and 100 get an A
if (grade > 89 && grade < 101)
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n = get_int("Enter a number: ");
int counter = 0;
// add your code here
while (n < 100)
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int number;
// write your do-while loop here to accept input between 0 and 10
do
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int total = 0;
for (int i = 0; i <= 10; i++)
{
total += i;
#include <cs50.h>
#include <stdio.h>
#define ONE_YEAR 1
#define age a
int main(void)
{
// Prompt user for age
int age = get_int("Enter your age: ");