Today, most people who learn a programming language know very little mathematical notation and are more familiar with other programming languages, and with symbols that are available on their computer keyboard. Of course, this wasn't the case in the 1950s and 1960s when some of the major programming language families that exist today appeared.
A lot of programming languages use a C-like syntax today because this has become the earlier convention. C established conventions such as braces
} to delimit code blocks, semicolons
; to delimit instructions, dot
. to access an element of a compound structure by name, the equal sign
= as the assignment operator, double-equal
== as the equality operator and
!= as inequality,
|| as logical-and and logical-or, square brackets
[…] for array indices, etc. C also participated in some conventions inherited from mathematics, such as the decimal notation for numbers, infix binary operators with parentheses for precedence, and the function call syntax with parentheses around the argument lists and commas to separate arguments
function(argument1, argument2, …).
The conceptors of C, like Wirth, followed some conventions already established in ALGOL. I think (but I'm not sure) that's where brackets for array access comes from.
Syntax choices are of course very strongly influenced by technical reasons: most languages use syntax that programmers will be able to type on their keyboard. To start with, most languages represent their source code as a sequence of lines, each line being itself a sequence of printable characters. This rules out some aspects of mathematical notation such as subscripts, superscripts, superposition (like the fraction notation), etc.
The set of available characters is usually limited to what typical computers of the time allow people to type easily. This self-perpetuates because operating system and keyboard manufacturers keep making these characters easily available. The basic standard set of characters today is ASCII: computer systems that don't support ASCII are extremely rare. Some of the characters in ASCII today weren't commonly available in the 1950s and 1960s, which explains why some languages that trace their roots to this time period don't use all of them.
An example of characters that are used by mathematicians, but weren't commonly available on computers at the time, is the logical operators $\wedge$, $\vee$ and $\neg$. FORTRAN and ALGOL 58 spelled them out
NOT. C (following some of its ancestors) used
!. Mathematicians never used
& for conjunction, as far as I know¹: that came from Latin (
& started out as a ligature for “et”, which is how the Latin word for ”and“ is spelled). Later versions of ALGOL added ∧ and ∨ as syntax for boolean operators, but since most computers didn't have them, they allowed other spellings, including
\/, which contributed to the imposition of the backslash as a standard character.
Some languages stray further from classical mathematical notations than C. A major example is Lisp, where the syntax for a function call is
(function argument1 argument2 …) and there are no infix operators. Lisp made this choice in the interest of uniformity: there is only one syntax for function calls and not many ($2+3$, $2^3$, $2x$, $\sin x$ are some examples of mathematical notations for function calls that don't follow the usual $f(x,y,\ldots)$ syntax). This uniformity has some theoretical advantages (Lisp was heavily inspired from the mathematical work on the lambda calculus), technical advantages (Lisp makes it easy to manipulate code as data objects), and sociological advantages (it makes the language easier to learn: for example you don't need to learn operator precedence).
A (basically the) notable language that baked in more classical mathematical notations is APL. It's still limited by the line syntax, but uses a special character set that includes characters such as $\leftarrow$, $\rightarrow$, $\neq$, $\neg$, $\subset$, $\supset$, etc. The special character set was a strong barrier to adoption because it required special software and made it harder to learn to type programs. The syntax of APL makes it very terse, and is a reasonably good fit for numerical programming, but it isn't particularly readable.
Beyond symbol availability, another reason for programming languages to depart from mathematical notation is the need for new concepts. Most programming languages incorporate syntax for imperative programming, with major concepts that mathematics doesn't have: operations done in sequence, assignment. For sequencing, the most logical character would have been
. following the typography of most languages, but that character was also used in mathematics for decimal numbers.
;, which is not used in mathematics, was the next logical candidate. For assignment, some languages tried to introduce $\leftarrow$, but since it wasn't available in typical character sets, it never really took on. The symbol
= was a logical candidate for both equality testing (“are these things equal?”) and assignment (“make this equal to that”). C uses
= for assignment and
== for equality testing. Other languages made different choices. ALGOL used the arguably more fitting
:= for assignment (more fitting because it's asymmetric, leaving the symmetric symbol
= free for the symmetric concept of equality). PL/1 uses
= for both and distinguishes the meaning from context, but this requires the language to distinguish between contexts that allow an assignment and contexts that allow a predicate and not to have any context that allows both. Some languages go closer to mathematical notation and use syntax like
set x = … or
let x = …; I think the designers of B and C considered this too verbose. I think FORTRAN was the heaviest original influence on imposing
= for assignment.
¹ Linear logic uses $\&$ but that's not the ordinary conjunction and that came later.