# Programming Paradigms – Arithmetic Operations

A common feature throughout all programming languages is how Arithmetic Operations are handled and the different types of operation available. Programming paradigms define stand structures and conventions for how specific things are done within programming languages and one of the areas covered is how arithmetic operations are used and applied when processing data. Some of the key features of arithmetic operations and the programming paradigms for this are explored below:

Mathematical operators: Common calculations can be done on numeric values such as addition, subtraction, multiplication and division and these are pretty much standard features across all programming languages. Normally common symbols for the four standard mathematical operations are + for plus, – for minus, / for divide and * or x for multiplication. Other arithmetic functions are also included such as rounding, finding max, finding min or producing random numbers. Again these are quite common and having an understanding of the programming paradigms of arithmetic operations is essential to develop accurate and efficient code.

Relational operators: When dealing with arithmetic operations another thing to be aware of is how to assign values and compare different values to each other. Standard assignment operators are = for equals, < for less than, > for greater than, <> or /= for not equal to, >= for greater than or equal to and <= for less than or equal to. Obviously the symbols used may vary slightly across different languages but find the correct one would be as simple as using the built in help and searching for something like ‘equal to’. Relational operators can be used to check one variable value against another and are commonly used within conditional functions such as IF statements to select a branch of code based on the comparison.

Boolean operators: These are used to determine to carry out boolean functions on data to check the status. Boolean operations such as AND can be used to determine if two conditions are met. Or NOT could be used to invert a value if there was the need to do this. Boolean operations are common features within programming paradigms and having the high level understanding of how they can be used makes programming more efficient if they are required. Boolean functions is used a lot when programming hardware as it is depending on the status of electronic components such as switches or warning lights.

Date and time assignment and calculations: Date and times can be formatted in many different ways in programming languages so understanding this is essential to produce the required data in a specified structure. Again and awareness of this and also how to compare dates or calculate the time between dates is essential in producing good code.

When considering how programming paradigms outline how arithmetic operations are used, some of the data types and how they are handled are reviewed in our post on handling data within a program. Understanding the specific rules and conventions is essential for cross language programming as programmer use the paradigms such as those for arithmetic operations in their thinking and can easily adapt to offer similar solutions in the desired language.