Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024_laba4_jaba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MATyufyakov
2024_laba4_jaba
Compare revisions
dc7e1ec9ac679b9a1e715eb2fa23b2e8f69ce891 to aa8ec07659ed08e78ff39ab83eff6eeed7aecdec
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
MATyufyakov/2024_laba4_jaba
Select target project
No results found
aa8ec07659ed08e78ff39ab83eff6eeed7aecdec
Select Git revision
Branches
main
Swap
Target
MATyufyakov/2024_laba4_jaba
Select target project
MATyufyakov/2024_laba4_jaba
1 result
dc7e1ec9ac679b9a1e715eb2fa23b2e8f69ce891
Select Git revision
Branches
main
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
1234567
· b68100b1
MATyufyakov
authored
2 months ago
b68100b1
1234567
· 893e5267
MATyufyakov
authored
2 months ago
893e5267
123456789
· aa8ec076
MATyufyakov
authored
2 months ago
aa8ec076
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
a.exe
+0
-0
0 additions, 0 deletions
a.exe
main.cpp
+61
-0
61 additions, 0 deletions
main.cpp
with
63 additions
and
0 deletions
.gitignore
0 → 100644
View file @
aa8ec076
*.exe
.vscode
This diff is collapsed.
Click to expand it.
a.exe
0 → 100644
View file @
aa8ec076
File added
This diff is collapsed.
Click to expand it.
main.cpp
0 → 100644
View file @
aa8ec076
/* числа фиббоначи
нужен n-ый символ ряда фиббоначи
на фходе число n
должна вывести число
g++ main.cpp -o fibbonaci
./fibbonaci.exe 5
*/
#include
<iostream>
long
long
unsigned
fibbonaci
(
int
n
){
if
(
n
==
1
||
n
==
2
){
return
1
;
}
long
long
unsigned
result_1
=
1
;
long
long
unsigned
result_2
=
1
;
long
long
unsigned
result_3
=
0
;
for
(
int
i
=
3
;
i
<=
n
;
i
++
){
result_2
=
result_1
+
result_2
;
result_1
=
result_2
-
result_1
;
}
return
result_2
;
return
fibbonaci
(
n
-
1
)
+
fibbonaci
(
n
-
2
);
}
int
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
!=
2
){
std
::
cout
<<
"incorrect usage"
<<
std
::
endl
;
return
1
;
}
int
n
=
atoi
(
argv
[
1
]);
if
(
n
<
1
){
std
::
cout
<<
"Use a number > 0"
<<
std
::
endl
;
return
2
;
}
if
(
n
>
93
){
std
::
cout
<<
"Number so BIG"
<<
std
::
endl
;
return
3
;
}
for
(
int
i
=
1
;
i
<=
n
;
i
++
){
std
::
cout
<<
"number"
<<
i
<<
": "
<<
fibbonaci
(
i
)
<<
std
::
endl
;
}
std
::
cout
<<
fibbonaci
(
n
)
<<
std
::
endl
;
return
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.