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