Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Sharon Christine
Page 7 of 34
Power Function in C/C++
The power function in C is used to calculate the power of a given number. The pow() function finds the value of a raised to the power b i.e., ab. Syntax double pow(double base, double exponent); The pow() function accepts two double values as parameters and returns a double value as output. It is defined in the math.h header file. If you pass integers to the power function, they are automatically converted to double data type. However, there's a potential precision issue with this conversion. Sometimes floating-point representation might store values slightly differently (e.g., ...
Read MoreArea of the largest triangle that can be inscribed within a rectangle?
A rectangle is a quadrilateral that has opposite sides equal and parallel, with adjacent sides at 90°. A triangle is a closed figure with three sides. The largest triangle that can be inscribed within a rectangle has its base equal to the length of the rectangle and height equal to the breadth of the rectangle. This triangle spans the entire diagonal of the rectangle. Length (l) Breadth (b) Largest Triangle ...
Read MoreSum of first N natural numbers which are divisible by X or Y
The sum of first N natural numbers which are divisible by X or Y involves finding all numbers from 1 to N that are multiples of either X or Y, then adding them together. This is a common problem in competitive programming and mathematical computations. Syntax // Method 1: Loop approach for(int i = 1; i
Read MoreC Program to Add two Integers
A program to add two integers takes two numbers, performs their mathematical sum, and stores the result in another variable. Syntax int sum = number1 + number2; Method 1: Adding Fixed Values This approach demonstrates adding two predefined integer values − #include int main() { int a = 545; int b = 123; int sum = a + b; printf("The first number is %d", a); ...
Read MoreC Program for Program to find the area of a circle?
The area is a quantity that represents the extent of the figure in two dimensions. The area of a circle is the area covered by the circle in a two-dimensional plane. To find the area of a circle, the radius [r] or diameter [d] (2 × radius) is required. The formula used to calculate the area is (π × r2) or {(π × d2)/4}. Syntax area = π × radius × radius area = (π × diameter × diameter) / 4 Method 1: Finding Area Using Radius This method calculates the circle area ...
Read MoreProgram to calculate Area Of Octagon
An octagon is a polygon with eight sides. To calculate the area of a regular octagon, we use a specific mathematical formula based on the side length. Syntax Area = 2 * (1 + √2) * side² Where side is the length of one side of the regular octagon. Formula Explanation The area of a regular octagon can be calculated using the formula − Area = 2 * (1 + √2) * a² Where: a is the side length of the octagon √2 is approximately 1.414 The coefficient 2 * ...
Read MoreProgram to calculate area of Enneagon
An enneagon (also known as nonagon) is a polygon with 9 sides. To calculate the area of an enneagon, we use a specific mathematical formula based on the side length. Syntax Area = (a² × 9) / (4 × tan(20°)) Area ≈ 6.1818 × a² Where a is the length of each side of the enneagon. ...
Read MoreProgram to calculate area and volume of a Tetrahedron
A tetrahedron is a pyramid with a triangular base i.e. it has a base that is a triangle and each side has a triangle. All the three triangles converge to a point. As shown in the figure − Base (triangle) Apex a The code to find the area and volume of tetrahedron uses the ...
Read MoreProgram to calculate area and perimeter of equilateral triangle
An equilateral triangle is a closed figure with three equal sides. We can calculate its area and perimeter using mathematical formulas that involve the side length. Syntax Area = (√3/4) * side2 Perimeter = 3 * side Formulas For an equilateral triangle with side length a − Area of equilateral triangle = (√3)/4 * a2 Perimeter of equilateral triangle = 3 * a Logic of Code To find the area of an equilateral triangle, the program uses sqrt() function from the math library to calculate the square root of ...
Read MoreHow to Install PHP 7 on Ubuntu Linux 14.04 LTS
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group. The latest version PHP is PHP7 and it provides 2x faster performance and 50% better memory consumption than PHP version 5.6. This article explains "How to install PHP7 on Ubuntu Linux". Prerequisites: Ubuntu 14.04 LTS system with sudo privileges and internet connection. Before installing PHP7, you should need to install a PPA called ondrej/php. This allows you to co-install PHP ...
Read More