FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithm/case1.php at master · mangcoding/algorithm · GitHub
mangcoding
/
algorithm
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithm
/
case1.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (31 loc) · 854 Bytes
Breadcrumbs
algorithm
/
case1.php
Copy path
File metadata and controls
32 lines (31 loc) · 854 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?PHP
$
angka
=
isset
(
$
_GET
[
"
angka
"
]) ?
$
_GET
[
"
angka
"
] :
7
;
$
kuadrat
=
$
angka
*
$
angka
;
$
a
=
$
kuadrat
-
$
angka
;
$
z
=
1
;
$
keatas
=
1
;
while
(
$
z
<=
$
kuadrat
) {
$
array
[
$
a
] =
$
z
++;
if
(
$
keatas
==
1
&& !
isset
(
$
array
[
$
a
-
$
angka
])) {
$
a
-=
$
angka
;
if
(
isset
(
$
array
[
$
a
-
$
angka
]) ||
$
a
==
0
) {
$
keatas
=
0
;
$
kekanan
=
1
;}
}
else
if
(
$
kekanan
==
1
&& !
isset
(
$
array
[
$
a
+
1
])) {
$
a
+=
1
;
if
(
isset
(
$
array
[
$
a
+
1
])) {
$
kekanan
=
0
;
$
kebawah
=
1
;}
}
else
if
(
$
kebawah
==
1
&& !
isset
(
$
array
[
$
a
+
$
angka
])) {
$
a
+=
$
angka
;
if
(
isset
(
$
array
[
$
a
+
$
angka
]) ||
$
a
==
$
kuadrat
-
1
) {
$
kebawah
=
0
;
$
kekiri
=
1
;}
}
else
if
(
$
kekiri
==
1
&& !
isset
(
$
array
[
$
a
-
1
])) {
$
a
-=
1
;
if
(
isset
(
$
array
[
$
a
-
1
])) {
$
kekiri
=
0
;
$
keatas
=
1
;}
}
}
for
(
$
i
=
0
;
$
i
<
$
kuadrat
;
$
i
++) {
$
cetak
= (
$
array
[
$
i
]<
10
) ?
"
0
"
.
$
array
[
$
i
] :
$
array
[
$
i
];
echo
$
cetak
.
"
"
;
if
(
$
i
%
$
angka
==(
$
angka
-
1
))
echo
"\n\n"
;
}
?>
Back
|
FazBrowse Home
|
New Git URL