Found 26504 Articles for Server Side Programming

C++ program to find the side of the Octagon inscribed within the square

Ayush Gupta
Updated on 09-Jul-2020 08:54:48

117 Views

In this tutorial, we will be discussing a program to find the side of the octagon inscribed within a given square.For this, we will be given with the side of a square and our task is to find the side of the largest octagon that can be inscribed in it.Finding the relation between the sides of the square and the octagon, we find the formula for the side of the octagonside of square/(√2 + 1)Example#include using namespace std; //calculating the side of the octagon float calc_oside(float a) {    if (a < 0)       return -1;   ... Read More

C program to find the Roots of Quadratic equation

Ayush Gupta
Updated on 09-Jul-2020 08:55:12

3K+ Views

In this tutorial, we will be discussing a program to find the roots of the Quadratic equation.Given a quadratic equation of the form ax2 + bx + c. Our task is to find the roots x1 and x2 of the given equation.For this, we are using the deterministic method, in thisD = √b2 - 4acthen the roots of the equation will bex1 = (-b + D)/2a ,andx2 = (-b - D)/2aExample#include #include #include //calculating the roots of equation void calc_roots(int a, int b, int c) {    if (a == 0) {       printf("Invalid Equation");       ... Read More

C++ program to find the rate percentage from compound interest of consecutive years

Ayush Gupta
Updated on 09-Jul-2020 08:55:38

180 Views

In this tutorial, we will be discussing a program to find the rate percentage from compound interest of the consecutive years.For this, we will be provided with two integers say A and B that are the interests of two consecutive years. Our task is to find the rate of interest for the given values.Finding the relation between the given values and eliminating the principal amount, we get the formula asrate = ((B-A)*100)/AExample#include using namespace std; //calculating the rate of interest float calc_rate(int N1, int N2) {    float rate = (N2 - N1) * 100 / float(N1);    return ... Read More

C++ program to find the Radius of the incircle of the triangle

Ayush Gupta
Updated on 21-Nov-2019 12:57:23

252 Views

In this tutorial, we will be discussing a program to find the radius of the incircle of a given triangle.For this, we will be provided with the sides of a particular triangle and our task is to find the radius of the incircle in that triangle.The formula for finding the radius of incircle isarea of the triangle/half perimeter of the triangleExample#include using namespace std; //calculating the radius of incircle float calc_radius(float a, float b, float c) {    if (a < 0 || b < 0 || c < 0)       return -1;    //half perimeter of ... Read More

C++ program to find the quantity after mixture replacement

Ayush Gupta
Updated on 21-Nov-2019 12:54:02

94 Views

In this tutorial, we will be discussing a program to find the quantity of milk left after mixture replacement.Let us suppose we have X litres of milk. From that, Y litres of milk is replaced with Y litres of water itself. This same procedure is done again and again Z number of times. Our task is to find the final amount of milk left in the container.Finding the relation among the values between the repetitive operations, we find the formula for finding the amount of milk after Z number of operations to beamount left = ((X-Y)/X)Z*XExample#include using namespace std; ... Read More

C Program for Hexagonal Pattern

Sunidhi Bansal
Updated on 21-Nov-2019 12:28:19

2K+ Views

We are given with an integer ‘n’ and the task is to generate the hexagonal pattern and display the final output.ExampleInput-: n=5 Output-:Input-: n = 4 Output-:Approach we are using in the given program is as follows −Input the number ‘n’ from userDivide the entire pattern into three parts i.e. upper part, middle part and lower part Start loop i for printing the upper part of the pattern from i to 0 and i to be less than n and keep incrementing the value of i Start loop m for printing the middle part of the pattern from m to ... Read More

C++ Program for class interval arithmetic mean

Sunidhi Bansal
Updated on 09-Jul-2020 08:44:06

659 Views

We are given with three arrays where first array contains the upper limit for arithmetic mean, second array contains the lower limit for arithmetic mean and third array contains the frequencies and the task is to generate the arithmetic mean of class intervals given.What is Arithmetic Mean?Arithmetic mean is the average value that is calculated by dividing the sum of all the elements in the set with the total number of elements in the given set.How to calculate Class Interval Arithmetic MeanGiven with Lower Limit, Upper Limit, FrequencyLower LimitUpper LimitFrequency121342563784Calculate the mid-point by adding the upper limit and lower limit ... Read More

C Program for Circumference of a Parallelogram

Sunidhi Bansal
Updated on 09-Jul-2020 08:45:53

193 Views

We are given with the sides of parallelogram and the task is to generate the circumference of a parallelogram with its given sides and display the resultWhat is a Parallelogram?Parallelogram is a type of quadratic which have −Opposite sides parallelOpposite angles equalPolygon diagonals bisects each otherShown in the below figure ‘a’ and ‘b’ are the sides of a parallelogram where parallel sides are shown in the figure.Perimeter/Circumference of a parallelogram is defined as −Circumference of Parallelogram = 2(a + b)                                           ... Read More

C program for Binomial Coefficients table

Sunidhi Bansal
Updated on 09-Jul-2020 08:48:19

8K+ Views

Given with a positive integer value let’s say ‘val’ and the task is to print the value of binomial coefficient B(n, k) where, n and k be any value between 0 to val and hence display the result.What is Binomial CoefficientBinomial coefficient (n, k) is the order of choosing ‘k’ results from the given ‘n’ possibilities. The value of binomial coefficient of positive n and k is given by$$C_k^n=\frac{n!}{(n-k)!k!}$$where, n >= kExampleInput-: B(9, 2) Output-:$$B_2^9=\frac{9!}{(9-2)!2!}$$ $$\frac{9\times 8\times 7\times 6\times 5\times 4\times 3\times 2\times 1}{6\times 5\times 4\times 3\times 2\times 1)\times 2\times 1}=\frac{362, 880}{1440}=252$$What is Binomial Coefficient TableThe Binomial Coefficient Table is formed ... Read More

C++ Program for Deadlock free condition in Operating Systems

Sunidhi Bansal
Updated on 09-Jul-2020 08:50:06

4K+ Views

Given with the P number of processes in the memory and N number of needed resources by them to complete their execution and the task is to find the minimum number of resources R which should be allotted to the processes such that deadlock will never occur.What is a DeadlockDeadlock is situation in an operating system where multiple processes residing in the memory doesn’t able to perform their execution because the resources which are needed for program execution is being hold by another resource who is waiting for some other resource for completion.Let’s say there are two processes P1 and ... Read More

Advertisements