From 567d6e203686d637ace1d8970b40ef9a99c65fe6 Mon Sep 17 00:00:00 2001 From: Arbaaz Shaikh Date: Sun, 29 Oct 2023 20:37:55 +0530 Subject: [PATCH] Create infinitebinarynums.cpp This is the code for infinte binary numbers in a very amazing pattern. --- infinitebinarynums.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 infinitebinarynums.cpp diff --git a/infinitebinarynums.cpp b/infinitebinarynums.cpp new file mode 100644 index 0000000..e9cb9ab --- /dev/null +++ b/infinitebinarynums.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; + +int main() { + +int n; +cout << "Enter the no. of turns : "; +cin >> n; + +for(int i = 1; 1 <= n; i++){ + for(int j = 1; j <= i; j++){ + cout << " "; + } + + if (i%2 == 1){ + cout << 1; + } + else { + cout << 0; + } +} +return 0; +}