I would like to know if there is any reason why many programming languages use the notation
% for the modulo operator?
It is used in the most "famous" languages:
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
Why did Thompson and Richie pick
%? It had to be a printable ASCII character that wouldn't conflict with B's other features.
% was available, and it resembles the
/ division operator, making it the obvious choice.
p.s. the creator of ASCII invented
\ to represent "reverse division", so it wasn't a candidate for modulo.
This is very likely a historical development. Looking at this table, we see that C was likely the first language to use
% for modulo. Its predecesor BCPL used
rem, and older languages such as Fortran, Algol, Lisp, and Cobol did not use
%. But that's just my uninformed guess.
I would like to know if there is any reason why many programming languages use the notation % for the modulo operator?
I would strongly suspect it is because both Unix and Windows (the two operating system families that have survived to the present day), chose C as their main programming language. The result is most of the programming languages we use today, were designed in environments where C and/or C++ were the dominant "systems" programming language.
People designing a new language will undoubtedly have aspects that they wish to change from previous languages, but there will also be aspects that they think are fine the way they are or at least aspects they can't think of a better solution for. Development of mainstream programming languages has been more evolutionary than revolutionary.
The result has been that most successful programming languages over the past few decades have been directly or indirectly influenced by C. Lets look at the languages on your list in chronological order and see what environments they were developed in and/or what languages were used to develop them.