Search
 
SCRIPT & CODE EXAMPLE
 

CPP

print pattern and space in cpp

//WAP to print triangle pattern... LOGIC
int num{}, i{1};
  cin >> num;
  while (i <= num) {
    for (int space = 1; space <= (num - i); space++) {  // space
      cout << " ";
    }
    for (int value = 1; value <= (2 * i - 1); value++) {  // value
      cout << value;
    }
    cout << endl; //next row
    i++;
  }
Comment

PREVIOUS NEXT
Code Example
Cpp :: how many months have 31 days 
Cpp :: how to make Dijkstra in c++ 
Cpp :: insertion sort cpp 
Cpp :: descending order c++ 
Cpp :: sort vector from largest to smallest 
Cpp :: c++ if example 
Cpp :: what is meant by pragma once in c++ 
Cpp :: c++ string slicing 
Cpp :: list in c++ 
Cpp :: c++ clip values 
Cpp :: c++ multiple inheritance 
Cpp :: pointer cpp 
Cpp :: find a number in vector c++ 
Cpp :: resize string c++ 
Cpp :: structure of a function in C++ 
Cpp :: read string with spaces in c++ 
Cpp :: number of nodes of bst cpp 
Cpp :: exception handling class c++ 
Cpp :: Fisher–Yates shuffle Algorithm c++ 
Cpp :: c++ fonksion pointer 
Cpp :: google test assert stdout 
Cpp :: C++ program to sizes of data types 
Cpp :: c++ regex count number of matches 
Cpp :: Operators in C / C++ 
Cpp :: prime number program c++ 
Cpp :: has substr c++ 
Cpp :: unordered map c++ 
Cpp :: compare function in c++ 
Cpp :: convert single character string to char c++ 
Cpp :: C++ pointer to base class 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =