Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 04 / example10.cpp
diff options
context:
space:
mode:
Commit72eb06dcc769114c7dbdcf7092e218b58d2196bf (patch)
Author
 Kamen Mladenov <kamen.d.mladenov@protonmail.com>
2021-11-03 19:39:06 +0200
Committer
 GitHub <noreply@github.com>
2021-11-03 19:39:06 +0200
Files452ee4354c0cd3edac025f81be477fd3f4268916 /Sem. 04/example10.cpp
Introduction_to_programming_FMI-72eb06dcc769114c7dbdcf7092e218b58d2196bf.tar
Introduction_to_programming_FMI-72eb06dcc769114c7dbdcf7092e218b58d2196bf.tar.gz
Introduction_to_programming_FMI-72eb06dcc769114c7dbdcf7092e218b58d2196bf.zip
Parentd0071de8895c62003670e95421b5bc11185e69a9 (diff)
Parent91c58192153aec6803de90951e2d72b36fcc4e16 (diff)
Merge branch 'Angeld55:main' into sem03-solutions
1 files changed, 21 insertions, 0 deletions
-rw-r--r--Sem. 04/example10.cpp21
diff --git a/Sem. 04/example10.cpp b/Sem. 04/example10.cpp
new file mode 100644
index 0000000..f7f072b
--- /dev/null
+++ b/Sem. 04/example10.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+using namespace std;
+
+unsigned int log(unsigned int n, unsigned int k)
+{
+ int count = 0;
+
+ while (n >= k)
+ {
+ n /= k;
+ count++;
+ }
+
+ return count;
+}
+
+
+int main()
+{
+ cout << log(4, 10) << endl;
+} \ No newline at end of file