home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / modula2 / tutorial / programs / intvar.mod < prev    next >
Text File  |  1993-03-14  |  744b  |  31 lines

  1.                                          (* Chapter 3 - Program 1 *)
  2. MODULE IntVar;
  3.  
  4. FROM InOut IMPORT WriteLn, WriteString, WriteInt;
  5.  
  6. VAR Count : INTEGER;  (* The sum of two variables *)
  7.     x,y   : INTEGER;  (* The two variables to add *)
  8.  
  9. BEGIN
  10.  
  11.    x := 12;
  12.    y := 13;
  13.    Count := x + y;
  14.  
  15.           (* Assignments complete, now display the results *)
  16.  
  17.    WriteString("The value of x  =");
  18.    WriteInt(x,3);
  19.    WriteLn;
  20.    WriteString("The value of y  =");
  21.    WriteInt(y,4);
  22.    WriteLn;
  23.    WriteString("The sum of them =");
  24.    WriteInt(Count,6);
  25.    WriteLn;
  26.  
  27.    x := 0FFH;   (* This is the way to assign a hexadecimal number *)
  28.    y := 177B;   (* This is the way to assign an octal number      *)
  29.  
  30. END IntVar.
  31.