---
title: "Division and modulo in C/C++, Java and Python"
author: "yaojingguo"
date: "2013-12-19T12:58:08Z"
tags: []
categories: ["编程语言"]
slug: "division-and-modulo-in-c-c-java-and-python"
draft: false
lastmod: "2013-12-19T12:59:08Z"
id: 1991908
url: "https://yaojingguo.iteye.com/blog/1991908"
---

> 
> a is an integer, n is a positive integer.
> 
> C/C++
> =====
> quotient is rounded towards zero. 
> a mod n = a - n (a/n)
> 
> Python
> ======
> Same as defined by CRLS.
>