C Language Tutorials by Ghulam Murtaza Dahar - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Meaning Of Operator

+

addition or unary plus

-

subtraction or unary minus

*

multiplication

/

division

%

remainder after division( modulo division)

Example of working of arithmetic operators

/* Program to demonstrate the working of arithmetic operators in C. */

#include <stdio.h>

int main(){

int a=9,b=4,c;

c=a+b;

printf("a+b=%d\n",c);

c=a-b;

printf("a-b=%d\n",c);

c=a*b;

printf("a*b=%d\n",c);

c=a/b;

printf("a/b=%d\n",c);

c=a%b;

printf("Remainder when a divided by b=%d\n",c);

return 0;

}

}

a+b=13

a-b=5

a*b=36

a/b=2

Remainder when a divided by b=1