Math in your C source code is done by the +, ?, *, and / operators.
These are the basic math symbols, with the exception of * and /, which is for time and divide.
The following table 1 lists the basic C language math operators.
Operator | Function |
---|---|
+ | Addition |
? | Subtraction |
* | Multiplication |
/ | Division |
#include <stdio.h> int main() /* w w w .j ava2 s .c om*/ { puts("Values 8 and 2:"); printf("Addition is %d\n",8+2); printf("Subtraction is %d\n",8-2); printf("Multiplication is %d\n",8*2); printf("Division is %d\n",8/2); return(0); }