
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

223 Views
In this tutorial, we will be discussing a program to find the area of an Ellipse.For this, we will be provided with the semi-major axis and semi-minor axis of the Ellipse. Our task is to calculate and print out the area of the given Ellipse.Example Live Demo#include using namespace std; //finding area of ellipse void findArea( float a, float b) { float Area; Area = 3.142 * a * b ; cout

303 Views
Suppose we have an array called nums, where nums[i] are written on a chalkboard. Ram and Sam take turns erasing exactly one element from the chalkboard, with Ram starting first. If erasing a number causes the bitwise XOR of all the elements of the chalkboard to become 0, then that player loses. Bitwise XOR of one element is that element itself, and the bitwise XOR of no elements is 0. If any player starts their turn with the bitwise XOR of all the elements of the chalkboard equal to 0, then that player will win. Suppose the array is holding ... Read More

215 Views
In this problem, we are given a value that denotes the side of an icosahedron. Our task is to create a program to find the Area and Volume of Icosahedron in C++.Icosahedron is a regular 30 sided polyhedron. It has 20 equilateral triangles of the same side. There are only 12 vertices of this polyhedron.Dashed lines are for the edges that are behind the visible surface.Let’s take an example to understand the problem, Inputa = 4Program to illustrate the working of our solution, Example Live Demo#include using namespace std; float calcIcoSArea(float a) { return (8.660 * a * a); ... Read More

382 Views
Suppose we have one array A, we must move every element of A to either list B or list C. (These lists B and C are initially empty.) We have to check whether after such a move, it is possible that the average value of B is equal to the average value of C, and B and C are both non-empty.So if the input is like − [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], then the result will be true, To solve this, we will follow these steps −n := size of A, total := 0for initialize ... Read More

318 Views
In this problem, we are given a value that denotes the radius of a semicircle. Our task is to create a program to find the Area and Perimeter of a Semicircle in C++.SemiCircle is a closed figure that is half of a circle.Let’s take an example to understand the problem, InputR = 5Outputarea = 39.25 perimeter = 15.7Solution ApproachTo solve the problem, we will use the mathematical formula for the area and perimeter of a semi-circle which is derived by dividing the area of circle by 2.Area of semicircle, A= $½(\prod^*a^2)=1.571^*a^2$Perimeter of semicircle, P =(π*a)Area of semicircle, area = $½(π^*a^2)$Program ... Read More

157 Views
Suppose we have an array A, we may rotate it by a K so that the array becomes A[K], A[K+1], A{K+2], ... A[A.length - 1], A[0], A[1], ..., A[K-1]. Then, any entries that are less than or equal to their index are worth 1 point.So for example, let we have an array [2, 4, 1, 3, 0], and we rotate by K = 2, it becomes [1, 3, 0, 2, 4]. This is worth 3 points because 1 > 0 [gain no point], 3 > 1 [gain no point], 0

219 Views
Suppose we have a function f(x), this will return the number of zeroes at the end of factorial of x. So for f(3) = 0 because 3! = 6 has no zeroes at the end, while f(11) = 2 because 11! = 39916800 has 2 zeroes at the end. Now when we have K, we have to find how many non-negative integers x have the property that f(x) = K.So if the input is like K = 2, then the answer will be 5.To solve this, we will follow these steps −Define a function ok(), this will take x,ret := 0for initialize i := 5, when i

546 Views
Suppose we have one sorted list, there is 1 and some prime numbers, now for every p < q in the list, we will consider fraction p/q, then we have to find which is the kth smallest fraction. We have to return an array as answer, so ans[0] will be p and ans[1] will be q.So if the input is like [1, 3, 5, 7], and k = 2, then the answer will be 1/5, as the fractions are 1/3, 1/5, 1/7, 3/5, 3/7, 5/7, the second smallest is 1/5.To solve this, we will follow these steps −Define Data, this ... Read More

523 Views
Suppose we have one N x N board contains only 0s and 1s. Now in each move, we can swap any 2 rows, or any 2 columns. We have to find the minimum number of moves to transform the board into a "chessboard". If the solution does not exist, then return -1.So if the input is like −Then the output will be 2, as first two columns in the first move, then board will be like −Then swap second and 3rd rows −This is the chessboardTo solve this, we will follow these steps −n := size of bfor initialize i ... Read More

176 Views
Suppose we have a starting points (sx, sy), and target point (tx, ty), we have to check whether a sequence of moves exists from the start point to the end point. Here move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y).So if the inputs are (1, 1) and (4, 5), then the answer will be true, this is because move (1, 1) to (2, 1), then (3, 1), then (4, 1), then (4, 5).To solve this, we will follow these steps −while tx > sx and ty > sy, do −if ... Read More