File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ /*
1
2
// Doğum tarihi girilen kişinin yaşını hesaplayan programı yazınız.
2
3
function yasHesapla() {
3
4
const dYili = parseInt(prompt("Doğum yılınızı giriniz:", 1998));
@@ -9,9 +10,11 @@ function yasHesapla() {
9
10
let newMonth = date.getMonth();
10
11
let newDate = date.getDate();
11
12
12
- console . log ( newYear ) ;
13
13
console.log(`Yaşınız: ${newYear-dYili} yıl ${newMonth-dAy} ay ${newDate-dGun} gün`);
14
14
}
15
- yasHesapla ( ) ;
15
+ yasHesapla();
16
+ */
16
17
17
18
console . log ( "************ Exercise-4 ************" ) ;
19
+
20
+ /* yorum satırlarını kaldırın */
Original file line number Diff line number Diff line change
1
+ // Sayıları geriye yazdıran program
2
+
3
+ function countDown ( num ) {
4
+ console . log ( num ) ;
5
+ const newNumber = num - 1 ;
6
+ if ( newNumber >= 0 ) {
7
+ countDown ( newNumber ) ;
8
+ }
9
+
10
+ }
11
+ countDown ( 4 ) ;
12
+
13
+ console . log ( "************ Exercise-5 ************" ) ;
Original file line number Diff line number Diff line change
1
+ // Faktöriyel bulma programı
2
+
3
+ function factorial ( x ) {
4
+ if ( x == 0 ) {
5
+ return 1 ;
6
+ }
7
+ else if ( x < 0 ) {
8
+ return - 1 ;
9
+ }
10
+ else {
11
+ return x * factorial ( x - 1 ) ;
12
+ }
13
+ }
14
+
15
+ const num = 3 ;
16
+ if ( num > 0 ) {
17
+ let result = factorial ( num ) ;
18
+ console . log ( result ) ;
19
+ }
20
+
21
+ console . log ( "************ Exercise-6 ************" ) ;
Original file line number Diff line number Diff line change 9
9
< body >
10
10
< h1 > Please open console</ h1 >
11
11
12
+
12
13
14
+ < script src ="/beginner/ex6.js "> </ script >
15
+ < script src ="/beginner/ex5.js "> </ script >
13
16
< script src ="/beginner/ex4.js "> </ script >
14
17
< script src ="/beginner/ex3.js "> </ script >
15
18
< script src ="/beginner/ex2.js "> </ script >
You can’t perform that action at this time.
0 commit comments