G
Gergely Kontra
--nVMJ2NtxeReIH9PS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi!
Is there a similar construct to python's:
=2E.. for x in range(2, n):
=2E.. if n % x =3D=3D 0:
=2E.. print n, 'equals', x, '*', n/x
=2E.. break
=2E.. else:
=2E.. # loop fell through without finding a factor
=2E.. print n, 'is a prime number'
=2E..=20
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
thx
Gergo
--=20
+-[ Gergely Kontra <[email protected]> http://www.mcl.hu/~kgergely ]------+
| PhD Student (Room:IB113) PGP ID: 0x66875624 Mobile+36 20)356 9656 |
| Budapest University of Technology and Economics ICQ# 175564914 |
+------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+
--nVMJ2NtxeReIH9PS
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFDL0aHrl/uZWaHViQRAiDrAKDFEHzKgqVPZb4XehXaxw8bk3lbbACcCkDh
AEUPq1+ejfEWYx4+X+8fr38=
=GfHU
-----END PGP SIGNATURE-----
--nVMJ2NtxeReIH9PS--
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi!
Is there a similar construct to python's:
=2E.. for x in range(2, n):
=2E.. if n % x =3D=3D 0:
=2E.. print n, 'equals', x, '*', n/x
=2E.. break
=2E.. else:
=2E.. # loop fell through without finding a factor
=2E.. print n, 'is a prime number'
=2E..=20
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
thx
Gergo
--=20
+-[ Gergely Kontra <[email protected]> http://www.mcl.hu/~kgergely ]------+
| PhD Student (Room:IB113) PGP ID: 0x66875624 Mobile+36 20)356 9656 |
| Budapest University of Technology and Economics ICQ# 175564914 |
+------------- "Olyan langesz vagyok, hogy poroltoval kellene jarnom!" -+
--nVMJ2NtxeReIH9PS
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFDL0aHrl/uZWaHViQRAiDrAKDFEHzKgqVPZb4XehXaxw8bk3lbbACcCkDh
AEUPq1+ejfEWYx4+X+8fr38=
=GfHU
-----END PGP SIGNATURE-----
--nVMJ2NtxeReIH9PS--