(1) /* this program computes the greatest common divisor
(2) of two integers entered on the command line */
(3) #include <stdio.h>
(4) #include <stdlib.h>
(5) int gcd(int m, int n)
(6) {
(7) int r;
(8) while ((r = m % n) != 0) {
(9) m = n;
(10) n = r;
(11) }
(12) return n;
(13) }
(14) int main(int argc, char *argv[])
(15) {
(16) int m, n;
(17) m = atoi(argv[1]);
(18) n = atoi(argv[2]);
(19) printf("gcd of %d and %d is %d\n", m, n, gcd(m, n));
(20) return 0;
(21) }
char, int, double, float,
enum, void
.if-else, switch, while, for,
do-while, break, continue
and goto
.try-catch
construct to catch exceptions raised by the
throw
statement.