By using the + and - operators, we can swap two numbers without using a third variable. Main logic: //Logic…
A palindrome number is a number that remains the same when digits are reversed. For example, the number 125521 is a palindrome…
n1 is compared to n2. If n1 is larger than n2, it is compared to n3. If it is greater than n3…
A prime number is greater than one and can be divided by one or itself. In other words, prime numbers…
Program code: #include<iostream> using namespace std; void display(int n) { int space = n / 2, num= 1; for (int…
Floyd’s triangle is a triangular array of natural numbers and it is named after Robert Floyd, a renowned computer scientist popularly…
Pascals triangle is a triangular array of binomial coefficients. The numbers outside Pascals triangle are all "0". These "0s" are…
C++ programming using "*" for Christmas Tree Pattern Program code: #include<iostream> using namespace std; int main() { int width, height,…
In this program, we use numbers to generate a pyramid-like pattern. And numbers follow a pattern similar to this: 1…
C++ implementation for pattern printing. Pattern 1: Program code: #include <iostream> using namespace std; void pattern(int n) { // Outer…