Skip to content

About

My first program in C

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

// Calculator // My first program in C #include <cs50.h> #include <stdio.h> int sum(int x, int y); int sub(int x, int y); int mul(int x, int y); int div(int x, int y); int main(void) { // ask the user for inputes int x, y; char a, b, c, d; x = get_int("what is x: "); c = get_char("what is c: "); y = get_int("what is y: "); if (c == '+') { printf("%i\n", sum(x, y)); } if (c == '-') { printf("%i\n", sub(x, y)); } if (c == '*') { printf("%i\n", mul(x, y)); } if (c == '/') { printf("%i\n", div(x, y)); } }

int sum(int x, int y) { return x + y; }

int sub(int x, int y) { return x - y; }

int mul(int x, int y) { return x * y; }

int div(int x, int y) { return x / y; }

About

My first program in C

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors