icp/oer/courses/c-basics/sections/02-basic-language-features/00-expressions/program.c

23 lines
798 B
C

#include <stdio.h>
int main(int argc, const char *argv[])
{
// we prepared the printf function, so it will print a number, which we pass behind the string
printf("%d\n", (10*5)/7+1);
// instead of a number we passed a more complex expression with some operators.
// execute the program and see what it evaluated to.
// TODO: change the expression to print out 42 using some operators
printf("%d", 5+5);
// You can also just write expression. They will be evaluated, but
// because we are not using them, they are useless
5; // This is an expression.
3+6; // This is also an expression. It will evaluate to 9.
!(5+6 > (4*5-1)); // You can build long expressions.
// later we will safe these values in variables or will pass them to other function.
return 0;
}