Untitled
unknown
plain_text
3 years ago
482 B
4
Indexable
//Considere siguiente proceso repititivo para un numero entero dado: si el numero es 1, el proceso termina #include <iostream> #include <ctime> using namespace std; int main() { int n; cout << "Ingrese numero: "; cin >> n; while (n != 1) { if (n % 2 == 0) { n = n / 2; } else { n = (n * 3) + 1; } cout << n << ", "; } cout << endl; return 0; }
Editor is loading...