Basic Arithmetic Operations and Basic Arithmetic Operators - C Operator

C examples for Operator:Arithmetic Operator

Introduction

An arithmetic statement is of the following form:

variable_name = arithmetic_expression;

The following table lists the Basic Arithmetic Operators.

Operator Action
+Addition
-Subtraction
*Multiplication
/Division
%Modulus

Demo Code

#include <stdio.h>

int main(void){
  int total = 5;/* ww  w.j  av a  2s.co m*/

  int eaten = 2;
  
  total = total - eaten;
  
  printf("%d eaten  %d total", eaten, total);

  return 0;
}

Result


Related Tutorials