
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

3K+ Views
Natural numbers are positive numbers starting from 1, such as 1, 2, 3, and so on. Here, we will take a positive number n as input and and then will find the sum of all natural numbers from 1 up to n using recursion using C++ program. Example Input: n = 5 The sum of the first 5 natural numbers is: 1 + 2 + 3 + 4 + 5 = 15 Output: 15 Input: n = 8 The sum of the first 8 natural numbers is: 1 + 2 + 3 + 4 + 5 + 6 ... Read More

2K+ Views
A prime number is a number greater than 1 that has no divisors other than 1 and itself. For example, 2, 3, 5, 7, and 11 are prime numbers. In this article, we'll show you how to write a C++ program to display prime numbers between two intervals using function. For example, given the interval from 0 to 50, we want to print all the prime numbers within this interval. Input: Starting interval: 0 Ending interval: 50 Output: Prime numbers in the interval [0, 50] are: 2 3 5 7 11 13 17 19 23 29 31 ... Read More

2K+ Views
In this article, we will show you how to write C++ programs to create different pyramids and patterns. You can create many kinds of patterns using stars, numbers, and alphabets. Below is the list of patterns we will cover in this article- Simple Pyramid Pattern in C++ Flipped Simple Pyramid Pattern in C++ Inverted Pyramid Pattern in C++ Flipped Inverted Pyramid Pattern in C++ Triangle Pattern in C++ Inverted Triangle Pattern in C++ ... Read More

2K+ Views
In this article, we will understand how to display all the prime numbers from 1 to N in Java. All possible positive numbers from 1 to infinity are called natural numbers. A number is a prime number if its only factors are 1 and itself and cannot be divided by any other number. 11 is a prime number. Its factors are 1 and 11 itself. Some examples of prime numbers are 2, 3, 5, 7, 11, 13, and so on. 2 is the only even prime number. All other prime numbers are odd numbers. Below is a demonstration of the ... Read More

1K+ Views
An armstrong number is a positive integer that is equal to the sum of its digits, each raised to the power of the total number of digits in the number. Our goal here is to check armstrong numbers in C++. In simple terms, for a number with n digits: abcd... = a^n + b^n + c^n + d^n + ... If this condition is satisfied, we can say the number is an armstrong number. Let's understand with examples: 153 is an Armstrong number because: 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 ... Read More

568 Views
A prime number is a number greater than 1 that has no divisors other than 1 and itself. For example, 2, 3, 5, 7, and 11 are prime numbers. In this article, we'll show you how to write a C++ program to display prime numbers between two intervals. ExampleFor example, given the interval from 0 to 50, we want to print all the prime numbers within this interval. Input: Starting interval: 0 Ending interval: 50 Output: Prime numbers in the interval [0, 50] are: 2 3 5 7 11 13 17 19 23 29 31 37 41 ... Read More

8K+ Views
In this article, we'll show you how to write a C++ program to find the largest element in an array. An array is a collection of values that share the same data type. Our task is to go through all the elements stored in the array and find the one with the highest value. For example, consider the following arrays: //Example 1 int arr[] = {11, 13, 21, 45, 8}; Here, the largest element is 45. //Example 2 int arr[] = {1, 9, 2, 5, 7}; In this case, the largest element is ... Read More

2K+ Views
In this article, we will learn how to convert a binary number to a decimal number and a decimal number to a binary number using C++. This means converting numbers like 5 or 10 into a format that uses only 0s and 1s, and also converting binary numbers back into decimal. Decimal number system has a base of 10 as it uses 10 digits from 0 to 9, while binary has a base of 2 as it uses only 0 and 1. Binary is used in computers because digital devices can only represent two states: on(1) and off(0). Example ... Read More

10K+ Views
In this article, we'll show you how to write a C++ program to find the Greatest Common Divisor(GCD) of two numbers using Recursion. The GCD of two numbers is the largest number that divides both of them without leaving a remainder. It is also known as the Greatest Common Factor (GCF). For example, the GCD of 36 and 60 is 12, because 12 is the largest number that divides both 36 and 60 without a remainder. Using Recursion to Find the GCD To find the GCD, we use recursion. In recursion, a function keeps calling itself with updated ... Read More

1K+ Views
In this article, we'll show you how to write a C++ program to calculate the factorial of a number using recursion . The factorial of a number is the result of multiplying all the positive numbers from 1 to that number. It is written as n! and is commonly used in mathematics and programming. Let's understand this with a few examples: //Example 1 Input: 5 The factorial of 5 is: 5 * 4 * 3 * 2 * 1 = 120 Output: 120 //Example 2 Input: 6 The factorial of 6 is: 6 * 5 * 4 * ... Read More