Example 2. Coding in C/C++
from Pascal
program gcd_lcm(input,
output);
(*This program inputs a
specified number of pairs of
integers, and for each prints the
gcd and/or lcm as specified by
the user. *)
var
   noPairs: integer;
   choice: char;
   oneA, oneB: integer;
   i: integer;
#include <iostream.h>
int noPairs;
int oneA, oneB;
int i;