Programming Articles

Page 1967 of 2547

C++ Program to calculate the logarithm of a given number based on a given base

Arnab Chakraborty
Arnab Chakraborty
Updated on 07-Dec-2022 5K+ Views

In almost any modern programming languages, we find the few logarithm functions like natural logs, log with base 2, log with base 10 etc. But sometimes we need to calculate logarithm with different base which are not available in the given library functions. To achieve this goal we can use simple logarithmic formula. In this article we will see how to calculate logarithm values with a given number and a given base in C++. Formula to calculate logarithm with given base Let we have taken a number x, and its base is k which is also given. The ...

Read More

How to create Models in Keras?

Mithilesh Pradhan
Mithilesh Pradhan
Updated on 01-Dec-2022 389 Views

In this article, we are going to learn about how to create Models in Keras Introduction Keras is an open-source library in Python which provides APIs for building Artificial Neural Network Models with great flexibility. Modelling in Keras can be done either using the Functional API or the Keras Sequential Model. Keras module is also available under the popular Tensorflow Library. Latest version and installation The latest version of keras as of writing this article is 2.1.0. Keras can be installed from PyPI repository using pip. Advantages of Keras for Modelling Keras is used for fast implementation due to ...

Read More

Golang Program to extract the last two digits from the given year

Akhil Sharma
Akhil Sharma
Updated on 30-Nov-2022 2K+ Views

In this tutorial we will discuss how to write a GO program to extract the last two digits of a given year. This program takes any year as input and prints its last two digits. You need to extract the last two digits from a given year, by using the modulus operation. Modulus Operation The % operator is the modulus operator, which returns the remainder rather than the quotient after division. This is useful for finding numbers that are multiples of the same number. As the name suggests where there is an execution to be operated required to deal with ...

Read More

Swift Program to Convert Char type variables to Int

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 3K+ Views

This tutorial will discuss how to write swift program to convert char type variable to int. Swift support various datatypes and character and integers are one of them. Character represent single-character string like, “2”, “a”, “l”, etc. Whereas Integer represent numeric values like 2, 3, 45, 6, etc. To convert char type variable into Int type we can use any of the following method. Method 1 - Using whole Number Value Property We can convert char type variable into Int type using whole Number Value property. This property will convert character into number value if the character represent a ...

Read More

Swift Program to Calculate Cube Sum of First n Natural Numbers

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 392 Views

This tutorial will discuss how to write swift program to calculate cube sum of first n natural numbers. Natural numbers are those number which include all the positive number starting from 0 to infinite for example, 1, 2, 3, 4, ……n. Now we find the cube sum of first n natural numbers: 1+23+33+43 = 1 + 8 + 27 + 64 = 100. Below is a demonstration of the same − Input Suppose our given input is − Num = 5 Output The desired output would be − Cube Sum of first 5 numbers are 225. Algorithm Following ...

Read More

Swift Program to Calculate Area and Perimeter of Equilateral Triangle

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 680 Views

This tutorial will discuss how to write swift program to calculate area and perimeter of equilateral triangle A triangle whose all sides and angles are equal is known as the equilateral triangle. Each angle of equilateral triangle is 60 degrees. It is also known as 3-side polygon. Area of Equilateral Triangle The amount of space occupied between the three lines of the triangle is known as the area of the equilateral triangle. Formula Following is the formula − Area = √3x2/ 4 Here x is the side of the equilateral triangle. Below is a demonstration of the ...

Read More

Swift Program to Find the Mid-point of a Line

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 528 Views

This tutorial will discuss how to write swift program to find the mid-point of a line. A point lies between the middle of two points is known as mid-point. Suppose we have two points A and B and C point is the mid-point located between A and B. Midpoint always divide lines segment in equal parts. Or we can say mid-point is always equidistant from other two points. Formula Following is the formula − Midpoint = ((a1+a2)/2, (b1+b2)/2) Below is a demonstration of the same − Input Suppose our given input is − Point 1: (5.0, 6.0) ...

Read More

Swift Program to Calculate Distance Between Two Points

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 909 Views

This tutorial will discuss how to write swift program to calculate distance between two points. Suppose we have two points and a line connect these points together. So the length of the line is known as the distance between two points in a plane. This formula is used to find the distance between two points in XYplane. Formula Following is the formula − Distance = sqrt((a2-a1) + (b2-b1)) Below is a demonstration of the same − Input Suppose our given input is − Point 1: (1.0, 2.0) Point 2: (3.0, 4.0) Output The desired output would ...

Read More

Swift Program to Calculate Area of Hexagon

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 349 Views

This tutorial will discuss how to write swift program to calculate area of hexagon. A hexagon is a two-dimensional shape with 6 sides of same or different length. It contains six vertices and six interior angles. Hexagon is classified into four types according to their length and internal angles − Regular Hexagon Irregular Hexagon Convex Hexagon Concave Hexagon In this article we will find the area of Regular hexagon. Regular hexagon are those hexagons in which the all the sides are of equal length. The sum of all six interior angles is 720 degrees and the sum of ...

Read More

Swift Program to Calculate Area of Octagon

Ankita Saini
Ankita Saini
Updated on 30-Nov-2022 282 Views

This tutorial will discuss how to write swift program to calculate area of octagon. An octagon is a two-dimensional shape with 8 sides and also consists of eight interior and exterior angles. The total amount of space enclosed inside the octagon is known as the area of the octagon. Formula: Following is the formula of the area of the octagon − Area = 2 *(side)2*(1+√2) Below is a demonstration of the same − Input Suppose our given input is − side = 15 Output The desired output would be − Area of octagon = 1086.3961030678927 ...

Read More
Showing 19661–19670 of 25,466 articles
Advertisements