cyklus
#include <iostream> using namespace std; int main() { int n = 1; double v = 1; // a[1] = 1 while (n <= 10) { cout << "a " << n << " je " << v << endl; v = 2 * v + 1; // a[n] = 2 *a[n-1] +1 n = n + 1; } cout << "Konec" << endl; }
#include <iostream> using namespace std; int main(int argc, char** argv) { int n; cout << "vlozte cislo: "; cin >> n; cout << endl; int v = 1; for (int k = 1; k <= n; k++) { v = v * k; } cout << n << "! je " << v << endl; return 0; }
cyklus.txt · Last modified: 2019/09/26 12:41 by 127.0.0.1