This repository has been archived by the owner on Jun 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fd5938
commit c59e606
Showing
22 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'Swap | ||
scope | ||
|
||
dim a as integer = 10 | ||
dim b as integer = 30 | ||
|
||
dim pomocna as integer = b | ||
b = a | ||
a = pomocna | ||
|
||
print a; b; | ||
|
||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
30 10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
' Add numbers from 1 to n | ||
scope | ||
|
||
dim a as integer | ||
input a | ||
|
||
dim b as integer = 1 | ||
|
||
|
||
dim soucet as integer | ||
do while b <= a | ||
soucet = soucet + b | ||
b = b + 1 | ||
loop | ||
|
||
print !"Soucet cisel do"; a ; !" je"; soucet; | ||
|
||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
100 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
? Soucet cisel do 100 je 5050 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
' Print biggest number from three numbers | ||
scope | ||
|
||
dim a as integer | ||
dim b as integer | ||
dim c as integer | ||
|
||
input a | ||
input b | ||
input c | ||
|
||
if c > b then | ||
if c > a then | ||
print c; | ||
else | ||
print a; | ||
end if | ||
else | ||
print b; | ||
end if | ||
|
||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
100 | ||
150 | ||
125 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
? ? ? 150 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
' Program to Count Number of Digits in an Integer | ||
scope | ||
dim a as integer | ||
input a | ||
|
||
dim soucet as integer | ||
do while a <> 0 | ||
a = a \ 10 | ||
soucet = soucet + 1 | ||
loop | ||
|
||
print soucet; | ||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1456534 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
? 7 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
' Draw a pyramide | ||
scope | ||
print !"Enter number of rows\n"; | ||
dim rows as integer | ||
input rows | ||
|
||
print !"\n"; | ||
|
||
dim i as integer = 1 | ||
dim j as integer = 1 | ||
|
||
do while i <= rows | ||
j = 1 | ||
do while j <= i | ||
|
||
|
||
print j; | ||
j = j + 1 | ||
loop | ||
print !"\n"; | ||
i = i + 1 | ||
loop | ||
|
||
end scope | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Enter number of rows | ||
? | ||
1 | ||
1 2 | ||
1 2 3 | ||
1 2 3 4 | ||
1 2 3 4 5 | ||
1 2 3 4 5 6 | ||
1 2 3 4 5 6 7 | ||
1 2 3 4 5 6 7 8 | ||
1 2 3 4 5 6 7 8 9 | ||
1 2 3 4 5 6 7 8 9 10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
' Draw primary numbers from interval | ||
declare function prvocislo(cislo as integer) as boolean | ||
|
||
function prvocislo(a as integer) as boolean | ||
|
||
dim delitel as integer = a - 1 | ||
|
||
do while delitel > 1 | ||
|
||
if ((a \ delitel) * delitel) = a then | ||
return false | ||
else | ||
end if | ||
delitel = delitel - 1 | ||
loop | ||
|
||
|
||
|
||
return true | ||
end function | ||
|
||
scope | ||
dim flag as boolean | ||
print !"Enter two positive integers:\n"; | ||
|
||
dim n1 as integer | ||
dim n2 as integer | ||
|
||
input n1 | ||
print !"\n"; | ||
input n2 | ||
print !"\n"; | ||
|
||
print !"Prime numbers between"; n1 ; !" and"; n2 ; !" are"; | ||
|
||
dim i as integer = n1 + 1 | ||
|
||
do while i < n2 | ||
|
||
flag = prvocislo(i) | ||
|
||
if flag then | ||
print i; | ||
else | ||
end if | ||
|
||
i = i + 1 | ||
loop | ||
|
||
|
||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
10 | ||
20 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Enter two positive integers: | ||
? | ||
? | ||
Prime numbers between 10 and 20 are 11 13 17 19 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
' Count modulo | ||
function modulo(delitel as integer, delenec as integer) as integer | ||
dim vysledek as integer | ||
vysledek = delitel - (delitel\delenec)*delenec | ||
return vysledek | ||
end function | ||
|
||
scope | ||
print modulo (10, 4); | ||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
' GCD of Two Numbers using Recursion | ||
declare function modulo(a as integer, b as integer) as integer | ||
|
||
function hcf(n1 as integer, n2 as integer) as integer | ||
|
||
if n2 <> 0 then | ||
dim vysledek as integer | ||
vysledek = hcf(n2, modulo(n1, n2)) | ||
return vysledek | ||
else | ||
return n1 | ||
end if | ||
|
||
end function | ||
|
||
function modulo(delitel as integer, delenec as integer) as integer | ||
dim vysledek as integer | ||
vysledek = delitel - (delitel\delenec)*delenec | ||
return vysledek | ||
end function | ||
|
||
scope | ||
|
||
dim n1 as integer | ||
dim n2 as integer | ||
print !"Enter two positive integers:\n"; | ||
input n1 | ||
print !"\n"; | ||
input n2 | ||
print !"\n"; | ||
|
||
dim vysledek as integer | ||
vysledek = hcf(n1, n2) | ||
print !"G.C.D of"; n1; !" and"; n2 ; !" is"; vysledek; | ||
|
||
|
||
end scope |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
366 | ||
60 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Enter two positive integers: | ||
? | ||
? | ||
G.C.D of 366 and 60 is 6 |