---
title: "How to perform calculation ON CMD?"  
description: "How to perform calculation ON CMD?"  
author: "Arti Mishra"  
published: 2018-06-03  
updated: 2018-06-03  
canonical: https://answers.mindstick.com/qa/43847/how-to-perform-calculation-on-cmd  
category: "technology"  
tags: ["cmd"]  
reading_time: 2 minutes  

---

# How to perform calculation ON CMD?

How to perform [calculation](https://yourviews.mindstick.com/view/81720/google-does-largest-chemistry-calculation-new-chapter-in-quantum-computing) ON [CMD](https://www.mindstick.com/forum/159096/how-can-i-run-two-commands-in-one-line-in-windows-cmd)?

## Answers

### Answer by AMANDEEP SINGH

**In general, we use a calculator or any app for doing any calculation on windows, but other than that, we can also use DOS based calculator i.e Command Prompt that works through a set of commands.** Calculating arithmetic expressions on command line is more easy and expressive than other methods. Because command line comes very handy, when solving some complex logic.

The built-in DOS Shell has comprises of a mini calculator that can calculate simple arithmetic expressions on 32 bit signed integer.

The **“SET”** with /a switch DOS command is used to perform calculation on command prompt.

To know more on this command **type set /?** on the command prompt.

## Below are some of the general expressions:

C:\>set /a 3+3 will output 6

C:\>set /a 3*3 will output 9

C:\>set /a 8/4 will output 2

C:\>set /a 2+2 will output 4

C:\>set /a 5*(2/2)+10 will output 15

C:\>set /a (5*2)/2+10 will output 15

C:\>set /a “15>>2” will output 3

![How to perform calculation ON CMD?](https://answers.mindstick.com/questionanswer/ee184306-bccb-45be-8cc1-0a6c8486bfad/images/aff8c7df-c45f-4fa4-b2d2-cbf601a0a33c.jpeg)

**It also support other types of operators. Always remember to enclose the expression string in quotes when using logical or modulus operator.**

The following table lists the operators supported for /a in descending order of precedence.

![How to perform calculation ON CMD?](https://answers.mindstick.com/questionanswer/ee184306-bccb-45be-8cc1-0a6c8486bfad/images/3f3e9861-c25c-432c-8e77-0efe00db06d0.jpeg)

**Note: It overflow values for decimal integer. It removes the decimal point value and round of the integer. i.e 13/2 will result 6 instead of 6.5.**

\


---

Original Source: https://answers.mindstick.com/qa/43847/how-to-perform-calculation-on-cmd

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
