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() /*from w w w. j a v a2 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); }

- Write program to calculate remainder by dividing 5 from 1 to 30
- Write program to evaluate equation: 20 - 5 * 2 + 42 / 6