This repository has been archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p4.html
136 lines (124 loc) · 5.33 KB
/
p4.html
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title>Jorge González | Laboratorio de Lenguajes de Programación</title>
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="css/EnlighterJS.min.css" />
<meta name="EnlighterJS" content="Advanced javascript based syntax highlighting" theme="enlighter" data-indent="4" data-selector-block="pre" data-selector-inline="code" data-language="generic" />
</head>
<body class="is-preload">
<div id="wrapper">
<div id="main">
<div class="inner">
<header id="header">
<div class="align-center">
<ul class="pagination">
<li><a class="button" href="p3.html">Anterior</a></li>
<li><a class="page" href="p1.html">1</a></li>
<li><a class="page" href="p2.html">2</a></li>
<li><a class="page" href="p3.html">3</a></li>
<li><a class="page active">4</a></li>
<li><a class="page" href="p5.html">5</a></li>
<li><a class="page" href="p6.html">6</a></li>
<li><a class="page" href="p7.html">7</a></li>
<li><a class="page" href="p8.html">8</a></li>
<li><a class="page" href="p9.html">9</a></li>
<li><a class="page" href="p10.html">10</a></li>
<li><a class="button" href="p5.html">Siguiente</a></li>
</ul>
</div>
</header>
<section>
<header class="main">
<h1>Práctica #4</h1>
<h2>Serie de Fibonacci en C y C++</h2>
</header>
<ul>
<li>
<h4>C</h4>
<pre data-enlighter-languaje="c">
#include <stdio.h>
int fibonacci(int n) {
if (n <= 0) return 0;
if (n == 1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}
void main() {
int n, i = 0;
printf("Ingrese la cantidad de números a generar: ");
scanf("%d", &n);
printf("Serie de Fibonacci:\n");
while (i < n) {
printf("%d", fibonacci(i));
if (i > 0) printf(", ");
++i;
}
}
</pre>
</li>
<li>
<h4>C++</h4>
<pre data-enlighter-languaje="cpp">
#include <iostream>
using namespace std;
int fibonacci(int n) {
if (n <= 0) return 0;
if (n == 1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}
void main() {
int n, i = 0;
cout << "Ingrese la cantidad de números a generar: ";
cin >> n;
cout << "Serie de Fibonacci:\n";
while (i < n) {
cout << fibonacci(i);
if (i > 0) cout << ", ";
++i;
}
}
</pre>
</li>
</ul>
</section>
</div>
</div>
<div id="sidebar">
<div class="inner">
<nav id="menu">
<header class="major">
<h2>Menu Principal</h2>
</header>
<ul>
<li><a href="index.html">Inicio</a></li>
<li>
<span class="opener active">Prácticas</span>
<ul>
<li><a href="p1.html">Práctica #1</a></li>
<li><a href="p2.html">Práctica #2</a></li>
<li><a href="p3.html">Práctica #3</a></li>
<li><a>Práctica #4</a></li>
<li><a href="p5.html">Práctica #5</a></li>
<li><a href="p6.html">Práctica #6</a></li>
<li><a href="p7.html">Práctica #7</a></li>
<li><a href="p8.html">Práctica #8</a></li>
<li><a href="p9.html">Práctica #9</a></li>
<li><a href="p10.html">Práctica #10</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/browser.min.js"></script>
<script src="js/breakpoints.min.js"></script>
<script src="js/util.js"></script>
<script src="js/main.js"></script>
<script src="js/MooTools.min.js"></script>
<script src="js/EnlighterJS.min.js"></script>
</body>
</html>