Found 26504 Articles for Server Side Programming

Swift Program to Calculate Area of Octagon

Ankita Saini
Updated on 30-Nov-2022 07:05:19

196 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

Swift Program to Calculate Area of Circle Inscribed in Square

Ankita Saini
Updated on 30-Nov-2022 07:02:33

410 Views

This tutorial will discuss how to write swift program to calculate area of circle inscribed in square. We have a figure in which a circle is inscribed in a square. Which means the centre of the circle and the square is same and the diameter of the circle is equal to the length of the side of the square. If we have at least one measurement of square or the circle, then we can easily calculate the area and perimeter of the square, or area and circumference and area of the circle. Here we find the area of the ... Read More

Swift Program to Print Diagonal Matrix Pattern

Ankita Saini
Updated on 30-Nov-2022 06:35:43

423 Views

This tutorial will discuss how to write swift program to print Diagonal Matrix pattern. Diagonal matrix are those matrix in which all the elements are 0 except the principal diagonal.Or we can say that in a diagonal matrix off diagonal blocks are 0 and main diagonal blocks are square matrices. To create a diagonal matrix pattern we can use any of the following method − Using nested for loop Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 3 Output The desired output would be − 1 0 ... Read More

Swift Program to Print half Diamond Binary Pattern

Ankita Saini
Updated on 30-Nov-2022 06:34:58

224 Views

This tutorial will discuss how to write swift program to print half diamond binary pattern. Binary pattern is a sequence of “0” and “1” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. To create a half diamond binary pattern, we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 3 Output The desired output would be − 0 0 1 0 1 0 ... Read More

Swift Program to Print Inverted Binary Pattern

Ankita Saini
Updated on 30-Nov-2022 06:32:57

244 Views

This tutorial will discuss how to write swift program to print inverted binary pattern. Binary pattern is a sequence of “0” and “1” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. To create an inverted binary pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 3 Output The desired output would be − 1 0 1 0 0 1 0 1 ... Read More

Swift Program to Print Downward Triangle Binary Pattern

Ankita Saini
Updated on 30-Nov-2022 06:31:59

219 Views

This tutorial will discuss how to write swift program to print downward triangle binary pattern. Binary pattern is a sequence of “0” and “1” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. To create a downward triangle binary pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 5 Output The desired output would be − 1 1 0 1 0 1 ... Read More

Swift Program to Print Upper Binary Triangle Pattern

Ankita Saini
Updated on 30-Nov-2022 06:30:32

259 Views

This tutorial will discuss how to write swift program to print upper star triangle pattern. Binary pattern is a sequence of “0” and “1” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. To create a upper binary right triangle pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 3 Output The desired output would be − 1 1 0 1 0 ... Read More

Swift Program to Print Binary Right Triangle Pattern

Ankita Saini
Updated on 30-Nov-2022 06:25:32

289 Views

This tutorial will discuss how to write swift program to print Binary Right triangle pattern. Binary pattern is a sequence of “0” and “1” which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc. To create a binary right triangle pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Num = 4 Output The desired output would be − 1 1 0 1 0 1 ... Read More

Swift Program to Print Reverse Pyramid Alphabetic Pattern

Ankita Saini
Updated on 30-Nov-2022 06:24:14

348 Views

This tutorial will discuss how to write swift program to print reverse pyramid alphabetic pattern. Alphabetic pattern is a sequence of alphabets starting from A to Z which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc of alphabets. To create an alphabetic inverted pattern, we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Range = A to E Output The desired output would be − A B C D ... Read More

Swift Program to Print Alphabetic Inverted Pattern

Ankita Saini
Updated on 30-Nov-2022 06:22:34

237 Views

This tutorial will discuss how to write swift program to print alphabetic inverted pattern. Alphabetic pattern is a sequence of alphabets starting from A to Z which is used to develop different patterns or shapes like pyramid, rectangle, cross, etc of alphabets. To create a alphabetic inverted pattern we can use any of the following methods − Using nested for loop Using init() Function Using stride Function Below is a demonstration of the same − Input Suppose our given input is − Range = A to E Output The desired output would be − A B C D E ... Read More

Advertisements