
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

1K+ Views
In this tutorial, we are going to learn about the fixed partitioning in the operating system.Fixed partitioning is one to manage the memory in operating system. It's an old technique. It divides the memory into equal blocks. The size of each block is predefined and can not be changed.The memory is used for the contiguous processes.ExampleLet's see the sample program that allocates memory based on the process size. Live Demo#include using namespace std; int main() { int blockNumber = 5, processesNumber = 3; int blockSize[5] = {4, 4, 4, 4, 4}, processSize[3] = {1, 2, 3}; int flags[5], ... Read More

614 Views
In this tutorial, we are going to learn how find the first uppercase letter in the given string. Let's see an example.Input −TutorialspointOutput −TLet's see the steps to solve the problem using iterative method.Initialize the string.Iterate over the string.Check whether the current character is uppercase or not using isupper method.If the character is uppercase than return the current character.ExampleLet's see the code. Live Demo#include using namespace std; char firstUpperCaseChar(string str) { for (int i = 0; i < str.length(); i++) if (isupper(str[i])) { return str[i]; } ... Read More

159 Views
In this tutorial, we are going to find a triangular number whose number of divisors are greater than n.If the sum of natural numbers at any point less than or equal to n is equal to the given number, then the given number is a triangular number.We have seen what triangular number is. Let's see the steps to solve the problem.Initialize the numberWrite a loop until we find the number that satisfies the given conditions.Check whether the number is triangular or not.Check whether the number has more than n divisors or not.If the above two conditions are satisfied then print ... Read More

1K+ Views
In this tutorial, we are going to learn how to find the first non-repeating character in the given string. Let's see an example.Input −tutorialspointOutput −uLet's see the steps to solve the problem.Initialize the string.Initialize a map char and array to store the frequency of the characters in the string.Iterate over the string.Find the frequency of each character and store them in the map.Store the index of the character as well.Iterate over the character frequencies in the map.Print the first character with the frequency 1.ExampleLet's see the code.#include #include using namespace std; void findDistinctCharacters(string random_string) { // initializing ... Read More

102 Views
In this tutorial, we have to find whether the natural numbers from 1 to n is divided into two halves or not. It has to satisfy the following conditions.The absolute difference between the two series sum should be m.And the GCD of two sums should be 1 i.e.., co-primes.The sum of first n natural numbers is (n*(n+1))/2. We can find the sumOne and sumTwo as we have total sum and difference m. See the below equations.sumOne + sumTwo = (n*(n+1))/2 sumOne - sumTwo = mExampleCheck whether the absolute sum is equal to m or not. And then check for GCD. Live ... Read More

169 Views
In this tutorial, we are going to learn how to find first digit of the product of an array.Let's see the steps to solve the problem.Initialize the array.Find the product of the elements in the array.Divide the result until it's less than 10.Print the single-digitExampleLet's see the code. Live Demo#include using namespace std; int productOfArrayDigits(int arr[], int n) { int product = 1; for (int i = 0; i < n; i++) { product *= arr[i]; } return product; } int firstDigitOfNumber(int n) { while (n >= 10) { n /= 10; } return n; } int main() { int arr[] = { 1, 2, 3, 4, 5, 6 }; cout

151 Views
In this tutorial, we are going to write a program the finds the first digit of a factorial. Let's see an example.Input − 7Output − 5Let's see the steps to solve the problem.Initialize the numberFind the factorial of the number.Divide the number until it becomes a single digit.ExampleLet's see the code. Live Demo#include using namespace std; void findFirstDigitOfFactorial(int n) { long long int fact = 1; for (int i = 2; i = 10) { fact = fact / 10; } cout

175 Views
In this tutorial, we are going to learn how to find the vertex, focus, and directrix of a parabola. We are given constants of the parabola equation x, y, and z.There are straightforward formulas to find the vertex, focus, and directrix. Let's them.Vertex − (-y/2x, 4xz-y^2/4x)Focus − (-y/2x, 4xz-y^2+1/4x)Directrix − z-(y^2+1)4xExampleLet's see the code. Live Demo#include using namespace std; void findParabolaProperties(float x, float y, float z) { cout

3K+ Views
In this tutorial, we are going to write a program that finds the parity of a number.We can find the parity of a number efficiently by performing the following operations using xor and right-shift operators.int b; b = n ^ (n >> 1); b = b ^ (b >> 2); b = b ^ (b >> 4); b = b ^ (b >> 8); b = b ^ (b >> 16);If the last bit of the result is 1 then it's an odd parity else even parity.ExampleLet's see the code. Live Demo#include using namespace std; void findParity(int n) { ... Read More

9K+ Views
In this tutorial, we are going to write a program that sums digits of the given number until it becomes a single digit. Let's see an example.Input −4543Output −7Let's see the steps to solve the problem.Initialize a number.Initialize the sum to 0.Iterate until the sum is less than 9.Add each digit of the number to the sum using modulo operatorPrint the sumExampleLet's see the code. Live Demo#include using namespace std; void findTheSingleDigit(int n) { int sum = 0; while(n > 0 || sum > 9) { if(n == 0) { n = sum; sum = 0; } sum += n % 10; n /= 10; } cout