Difference between revisions of "2022 New Spec"
(Created page with "Figure 3 shows an algorithm represented using pseudo-code. '''Figure 3''' C ← 0 D ← 0 S ← 0 T ← 0 WHILE C < 3 AND D < 3 T ← T + 1 N1 ← generate random in...") |
|||
Line 23: | Line 23: | ||
The DIV operator calculates the whole number part resulting from an integer division, | The DIV operator calculates the whole number part resulting from an integer division, | ||
− | for example, 10 DIV 3 = 3 | + | for example, 10 DIV 3 = 3. |
+ | |||
Table 4 lists the DIV operators for each of the available programming languages. | Table 4 lists the DIV operators for each of the available programming languages. | ||
You should refer to the row for your programming language. | You should refer to the row for your programming language. | ||
+ | |||
+ | '''Table 4''' | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Programming Language !! Div | ||
+ | |- | ||
+ | | C# || / | ||
+ | |- | ||
+ | | Java || / | ||
+ | |- | ||
+ | | Pascal || Div | ||
+ | |- | ||
+ | | Python || // | ||
+ | |- | ||
+ | | VB || \ | ||
+ | |||
+ | |} |
Revision as of 08:50, 2 February 2023
Figure 3 shows an algorithm represented using pseudo-code.
Figure 3
C ← 0 D ← 0 S ← 0 T ← 0 WHILE C < 3 AND D < 3 T ← T + 1 N1 ← generate random integer between 1 and 6 inclusive N2 ← generate random integer between 1 and 6 inclusive OUTPUT N1, N2 S ← S + N1 + N2 IF N1 = 6 OR N2 = 6 THEN C ← C + 1 ENDIF IF N1 = N2 THEN D ← D + 1 ENDIF ENDWHILE A ← S DIV (T * 2) OUTPUT C, D, A
The DIV operator calculates the whole number part resulting from an integer division, for example, 10 DIV 3 = 3.
Table 4 lists the DIV operators for each of the available programming languages. You should refer to the row for your programming language.
Table 4
Programming Language | Div |
---|---|
C# | / |
Java | / |
Pascal | Div |
Python | // |
VB | \ |