EnglishРусский  

   ..

   euclidean.1.g

Ads

Scriptius script builder
Provides the best choice in work automation and great time saving features.

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

source\samples\easymath\euclidean.1.g
 1 /******************************************************************************
 2 *
 3 * Copyright (C) 2005, The Gentee Group. All rights reserved. 
 4 * This file is part of the Gentee open source project - http://www.gentee.com. 
 5 * 
 6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
 7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
 8 * ACCEPTANCE OF THE AGREEMENT.
 9 *
10 * ID: euclidean 17.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15 
16 func uint gcd( uint first second )
17 {
18    if !second : return first
19    return gcd( second, first % second )
20 }
21 
22 func main<main>
23 {
24    str     input
25    uint    first second
26    
27    print("This program finds the greatest common divisor 
28 by the Euclidean Algorithm.\n\n")
29 
30    while 1
31    {
32       first = uint( congetstr( "Enter the first number ( enter 0 to exit ): ", input ))
33       if !first : break
34       
35       second = uint( congetstr( "Enter the second number: ", input ))
36       print("GCD = \( gcd( first, second ))\n\n")
37    }
38 }
Edit