Flutter Least Common Multiple (LCM)

For finding LCM, we need to use the gcd function that Dart provides :   int gcd(int other); LCM can be calculated as follows: int getLCM(int a, int b) {   return (a * b) ~/ gcd(a, b); } Here is the complete code : void main() {   int a = 10, b = 25;   int […]

Android Studio – Gradle project refresh/sync failed : connection timed out

This article tries to address following issues while starting Android Studio Gradle sync failed: Connection timed out   Gradle project refresh failed : connection timed out If you are getting this error while starting Android studio, it will be mostly because its not able to connect to Internet. Check if you are able to connect […]

Swift : Optionals

What is Optional in Swift ? In Swift, variable values can be optional. That means that a variable will either be nil or it will have a valid value. We can declare a variable as Optional if there is a possibility that the variable may not have a valid value.   Declaring Optional variables and […]

Android Linear Layout

LinearLayout The widgets contained in LinearLayout are displayed in the order in which they are added. LinearLayout applies either vertical or horizontal ordering. All children of a LinearLayout are stacked one after the other, so a vertical list will only have one child per row, no matter how wide they are, and a horizontal list […]

Android RelativeLayout

RelativeLayout RelativeLayout displays child elements in relative positions. Each element’s position is specified relative to sibling elements parent RelativeLayout area.   This layout was automatically included in our Hello World App that we created in this article : Android Hello World App to accept user input   In this app, we added an EditText and […]