Server Side Programming Articles - Page 501 of 2650

Swift Program to Generate Multiplication Table

Ankita Saini
Updated on 01-Aug-2022 12:43:54

1K+ Views

This tutorial will discuss how to write a Swift program to generate Multiplication Table. A multiplication table is a list or table of multiples of a specified number. We can create a multiplication table by multiplying a number with whole numbers. Generally, a multiplication table is created upto 10 times but you can create it according to your need. Below is a demonstration of the same − Suppose our given input is − The desired output is − Following is the multiplication table is 9 9 * 1 = 10 9 * 2 = 20 9 * 3 ... Read More

Swift Program to Calculate Simple Interest

Ankita Saini
Updated on 04-Aug-2022 08:10:43

998 Views

This tutorial will discuss how to write a swift program to calculate simple interest. Simple interest is the most commonly used method to find the interest on the money for a given time period. In this method, the interest is always applied to the original principal amount with same the interest rate for every time period. It is calculated by multiplying the interest rate by the principal amount and the time. Formula Following is the formula of simple interest − S.I = Principal Amount(P) x Time(T) x Rate(R)/100 Where Principal(P) − Principal amount represents the amount that is initially invested. ... Read More

Swift Program to Calculate the Power of a Number

Ankita Saini
Updated on 01-Aug-2022 09:26:18

2K+ Views

This tutorial will discuss how to write a swift program to calculate the power of a number. Power of a number means how many times a number is used in multiplication, for example, 16 ^2 = 16 * 16 = 256 or 16 to the power of 2. It is also known as exponent or indices. Below is a demonstration of the same − Suppose our given input is − Number - 16 Exponent Value is - 3 The desired output is − Final result is 16^3 = 4096 Calculating power of a number using recursion We can calculate the ... Read More

How to Delete Specific Line from a Text File in Python?

Vikram Chiluka
Updated on 01-Aug-2022 08:22:05

25K+ Views

In this article, we will show you how to delete a specific/particular line from a text file using python.Assume we have taken a text file with the name TextFile.txt consisting of some random text. We will delete a particular line (for example line 2) from a text fileTextFile.txtGood Morning This is Tutorials Point sample File Consisting of Specific source codes in Python, Seaborn, Scala Summary and Explanation Welcome everyone Learn with a joyAlgorithmFollowing are the Algorithm/steps to be followed to perform the desired task −Create a variable to store the path of the text file.Use the open() function(opens a file ... Read More

How to Swap Two Numbers in Swift Program?

Ankita Saini
Updated on 29-Jul-2022 10:28:13

3K+ Views

This tutorial will discuss how to write a swift program to swap two numbers. Swapping of two variables means mutually exchanging the values of two variables.Swapping using temporary variableGiven two variables Number1 and Number2 now we swap their values with each other using a temporary variable Numtemp. It is the most easiest way to swap two numbers.AlgorithmThe algorithm is explained below −Step 1 − Declare three integer variables: Number1, Number2 and Numtemp(temporary variable.)Step 2 − Assign values to Number1 and Number2Step 3 − Assign Number1 to NumbertempStep 4 − Assign Number2 to Number1Step 5 − Assign Numbertemp to Number2Step 6 ... Read More

How to Read The Number From Standard Input in Swift Program?

Ankita Saini
Updated on 28-Jul-2022 12:40:08

2K+ Views

This tutorial will discuss how to write a swift program to read the number from standard input. Reading a number from standard input in Swift is very easy with the help of readLine(), Int(), and Float() functions.readLine() function − This function returns a string of characters which is read from the standard input at the end of the current line. If the control is already reached to the EOF when the readLine() function is called then this method will return nil.SyntaxFollowing is the syntax of Swift readLine() function −readLine(strippingNewline: true) Or readLine()Int() function − This function is used ... Read More

Swift Program to Multiply Two Floating-Point Numbers

Ankita Saini
Updated on 28-Jul-2022 09:40:01

760 Views

This tutorial will discuss how to write a swift program to multiply two floating point numbers.Floating point numbers are the numbers with fraction or numbers with decimal value for example 34.56, 987.23, 0.234, etc. In Swift, floating point data type has a wide range of values and can store much smaller or larger number as compare to Integer. Swift support two signed floating point number types that is Double and Float. Double is used to represent 64-bit floating point number and has precision of at least 15-decimal digit. Whereas Float is used to represent 32-bit floating point number and has ... Read More

How to Print an Integer in Swift Program?

Ankita Saini
Updated on 28-Jul-2022 09:26:11

2K+ Views

This tutorial will discuss how to write a swift program to print an Integer. Integers represents the number with no fractional component like 45, 980, -234, 24, etc. Swift supports both signed as well as unsigned integers in 8, 16, 32, and 64 bit. Here signed integer is represented by Int whereas unsigned integer is represented by UInt and their size is same as the current platform e.g if the platform is 32-bit then the size is Int32 or UInt32 unless you work with some specific size of the integer.SyntaxFollowing is the syntax for creating integer type variablevar x : ... Read More

Difference between Array and ArrayList

Pradeep Kumar
Updated on 22-Jul-2022 07:14:09

5K+ Views

Programmers should strive to effectively manage data as one of their primary responsibilities. There is a wide variety of data structures available to assist programmers in the process of data handling.The array data structure has been around for a very long time and is one of the most common data structures used to store data. The ease with which array can be implemented is one of the primary reasons for its widespread adoption. This makes it much easier for newcomers to comprehend the data structure.ArrayList is the name of one of the additional provisions that can be found in the ... Read More

Swift Program to Find the Area of a Circle

Ankita Saini
Updated on 29-Jul-2022 10:10:06

1K+ Views

This tutorial will discuss how to write a swift program to find the area of a Circle.In a circle, an area is known as the space that is enclosed inside the boundaries of the circle in the two-dimensional plane. Suppose we have a round tea table now the area of the circle helps us to find how much cloth we required to cover the top of the table. We can calculate the area of the circle with the help of the radius or diameter, here, We are going to use the formula of area of the circle −Area of the ... Read More

Advertisements