Skip to content

Instantly share code, notes, and snippets.

@jmichalenko
Created February 13, 2024 00:09
Show Gist options
  • Save jmichalenko/552bc5c3a19c6dc0b6313f939d026a42 to your computer and use it in GitHub Desktop.
Save jmichalenko/552bc5c3a19c6dc0b6313f939d026a42 to your computer and use it in GitHub Desktop.
CS50 Labs Operator Starter Code
#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
// declare an int c and assign it the value of a times 5
// declare an int d and set it to a divided by 4
// declare an int e and assign it to the remainder after dividing a by 4
// declare a float f and set it to a divided by 4.0
// printing the results
printf("\n");
printf("a plus 3 is %i\n", b);
printf("a times 5 is %i\n", c);
printf("a divided by 4 is %i\n", d);
printf("a mod 4 is %i\n", e);
printf("a divided by 4.0 is really %f\n", f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment