Created
February 21, 2025 10:55
-
-
Save karol-may/1eca434abb910b74bfea4a1a9a0883b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> | |
let pesel = "54031682866"; | |
let mnozniki = "13791379130"; | |
console.log("PESEL: " + pesel); | |
console.log("Suma kontrolna: " + pesel[10]); | |
let suma = 0; | |
for (let i = 0; i < pesel.length; i++) | |
{ | |
suma = suma + pesel[i]*mnozniki[i]; | |
console.log(pesel[i],"*",mnozniki[i],"=",pesel[i]*mnozniki[i], suma); | |
} | |
suma = suma%10; | |
console.log("suma%10=",suma); | |
suma = 10-suma; | |
console.log("10-suma=",suma); | |
suma = suma%10; | |
console.log("suma%10=",suma); | |
if (suma == pesel[10]) | |
{ | |
console.log("Pesel prawidłowy"); | |
} else { | |
console.error("Pesel nieprawidłowy"); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment