Sha256: 19bed8b080e3b00ee64107c25957d4493e53be61bf63524268c3803db3ad9432
Contents?: true
Size: 681 Bytes
Versions: 10
Compression:
Stored size: 681 Bytes
Contents
These operations are all built-in. As all operations are exact, there are no rounding issues involved. DoIt := proc() local a := readstat( "Input an integer: " ): local b := readstat( "Input another integer: " ): printf( "Sum = %d\n", a + b ): printf( "Difference = %d\n", a - b ): printf( "Product = %d\n", a * b ): printf( "Quotient = %d\n", iquo( a, b, 'c' ) ): printf( "Remainder = %d\n", c ); # or irem( a, b ) NULL # quiet return end proc: Here is an example of calling DoIt. > DoIt(); Input an integer: 15; Input another integer: 12; Sum = 27 Difference = 3 Product = 180 Quotient = 1 Remainder = 3 >
Version data entries
10 entries across 7 versions & 1 rubygems