
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 26504 Articles for Server Side Programming

184 Views
In this tutorial, we will be discussing a program to find the number of prime length palindromic strings.For this we will be provided with a string. Our task is to count all the sub strings which are palindromes and have prime lengths.Example Live Demo#include using namespace std; //checking for a palindrome bool if_palin(string str, int i, int j){ while (i < j) { if (str[i] != str[j]) return false; i++; j--; } return true; } //counting palindrome with prime length int count_prime(string str, int ... Read More

247 Views
In this tutorial, we will be discussing a program to find the number of sub-arrays having sum divisible by k.For this we will be provided with an array and a value k. Our task is to find the number of sub arrays that are having their sum as equal to the given value k.Example Live Demo#include using namespace std; //counting subarrays with k sum int count_subarray(int arr[], int n, int k){ int mod[k]; memset(mod, 0, sizeof(mod)); int cumSum = 0; for (int i = 0; i < n; i++) { cumSum += arr[i]; ... Read More

238 Views
In this tutorial, we will be discussing a program to find the number of all sorted rows in a matrix.For this we will be provided with m*n matrix. Our task is to count all the rows in the given matrix that are sorted either in ascending or descending order.Example Live Demo#include #define MAX 100 using namespace std; //counting sorted rows int count_srows(int mat[][MAX], int r, int c){ int result = 0; for (int i=0; i

188 Views
In this tutorial, we will be discussing a program to find the number of columns in a matrix which are sorted in descending.For this we will be provided with a matrix. Our task is to count the number of columns in the matrix having elements sorted in descending order.Example Live Demo#include #define MAX 100 using namespace std; //counting columns sorted in descending order int count_dcolumns(int mat[][MAX], int r, int c){ int result = 0; for (int i=0; i0; j--) if (mat[i][j-1] >= mat[i][j]) break; if ... Read More

169 Views
In this tutorial, we will be discussing a program to find the numbers in a range with the smallest factor as K.For this we will be provided with a range [a,b]. Our task is to count the numbers in the given range who have their smallest factor as K.Example Live Demo#include using namespace std; //checking if K is a prime bool if_prime(int k){ if (k

366 Views
In this tutorial, we will be discussing a program to find the number of sub sequences having product less than K.For this we will be provided with non-negative array and a value k. Our task is to find all the subsequences in the array having product less than k.Example Live Demo#include using namespace std; //counting subsequences with product //less than k int count_sub(vector &arr, int k){ int n = arr.size(); int dp[k + 1][n + 1]; memset(dp, 0, sizeof(dp)); for (int i = 1; i

9K+ Views
In this tutorial, we will be discussing how to handle the divide by Zero exception in C++.Division by zero is an undefined entity in mathematics, and we need to handle it properly while programming so that it doesn’t return at error at the user end.Using the runtime_error classExample Live Demo#include #include using namespace std; //handling divide by zero float Division(float num, float den){ if (den == 0) { throw runtime_error("Math error: Attempted to divide by Zero"); } return (num / den); } int main(){ float numerator, denominator, result; numerator = 12.5; denominator = 0; try { result = Division(numerator, denominator); cout

161 Views
In this tutorial, we will be discussing a program to understand how arrays are passed to functions.In the case of C/C++, the arrays are passed to a function in the form of a pointer which provides the address to the very first element of the array.Example Live Demo#include //passing array as a pointer void fun(int arr[]){ unsigned int n = sizeof(arr)/sizeof(arr[0]); printf("Array size inside fun() is %d", n); } int main(){ int arr[] = {1, 2, 3, 4, 5, 6, 7, 8}; unsigned int n = sizeof(arr)/sizeof(arr[0]); printf("Array size inside main() is %d", n); ... Read More

2K+ Views
The CSV file or comma separated values file are one of the most widely used flat files to store and hare data across platforms. The columns are separated by comma and there is optional header row also which will indicate the name of each column. Python can read the CSV files using many modules. In this article we will see how the CSV library in python can be used to read and write a CSV file. We can also see the pandas library onl to read the CSV file.Reading CSV file using csv moduleWe can get the CSV file from ... Read More

2K+ Views
Python language is used extensively for web programming. When we browser website we use the web address which is also known as URL or uniform resource locator. Python has inbuilt materials which can handle the calls to the URL as well as pass the result that comes out of visiting the URL. In this article we will see a module named as urllib. We will also see the various functions present in this module which help in getting the result from the URL.Installing urllibTo install urllib in the python environment, we use the below command using pip.pip install urllibRunning the ... Read More