C - Operator Arithmetic Operators

Introduction

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

Demo

#include <stdio.h> 
int main() //from w  w  w  .j  a v a 2s.c  o  m
{ 
    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); 
}

Result

Related Topics

Exercise