Programming Articles

Page 1985 of 2547

Kotlin Program to Find Area of Square

AmitDiwan
AmitDiwan
Updated on 17-Oct-2022 852 Views

In this article, we will understand how to find the Area of a Square. The area of a square is calculated using the formula. side*side Below is a demonstration of the same − Suppose our input is − Length of the side : 4 The desired output would be − Area of the square : 16 Algorithm Step 1 − START. Step 2 − Declare 2 integer values namely sideValue and myResult. Step 3 − Define the values. Step 4 − Calculate the area of the square using the formula side*side and store the result. Step ...

Read More

Kotlin Program to Calculate the Power of a Number

AmitDiwan
AmitDiwan
Updated on 17-Oct-2022 730 Views

In this article, we will understand how to calculate the power of a number. The calculate the power of a number is calculated using a loop and multiplying it by itself multiple times. Below is a demonstration of the same − Suppose our input is − Number : 4 Exponent value : 5 The desired output would be − The result is 1024 Algorithm Step 1 − START Step 2 − Declare three integer values namely baseValue, exponentValue and and myResult Step 3 − Define the values Step 4 − Using a while loop, multiply the input ...

Read More

Kotlin Program to Reverse a Number

AmitDiwan
AmitDiwan
Updated on 17-Oct-2022 2K+ Views

In this article, we will understand how to print an integer in Kotlin. The reverse of a number is computed using a loop and arithmetic operator % and /. Below is a demonstration of the same − Suppose our input is − The number : 123456 The desired output would be − The result is 654321 Algorithm Step 1 − START Step 2 − Declare two integer values namely myInput and reversed. Step 3 − Define the values Step 4 − Run a while loop Step 5 − Use modulus of 10 and get remainder for ‘myTemp’ ...

Read More

Kotlin Program to Count Number of Digits in an Integer

AmitDiwan
AmitDiwan
Updated on 17-Oct-2022 852 Views

In this article, we will understand how to count the number of digits in an integer. The digits in an integer are counted using a loop and a counter. Below is a demonstration of the same − Suppose our input is − Number : 15161718 The desired output would be − The result is : 8 Algorithm Step 1 − START Step 2 − Declare two integer values namely count and myInput. Step 3 − Define the values Step 4 − Using a while loop, divide the input value by 10 until the number is reduced to ...

Read More

Kotlin Program to Display Fibonacci Series

AmitDiwan
AmitDiwan
Updated on 17-Oct-2022 3K+ Views

In this article, we will understand how to find even sum of Fibonacci series till number N. A Fibonacci series is sequence of numbers formed by the sum of its two previous integers. An even Fibonacci series is all the even numbers of the Fibonacci series. A Fibonacci series till number N i.e., 10 can look like this − 0 1 1 2 3 5 8 13 21 34 Below is a demonstration of the same − Suppose our input is − The input : 15 The desired output would be − The Fibonacci series till 15 terms: 0 ...

Read More

Introduction to TensorFlow Lite

AmitDiwan
AmitDiwan
Updated on 14-Oct-2022 598 Views

TensorFlow Lite is a mobile library designed to deploy models on mobile, microcontrollers and edge devices. It comes with tools that enable on-device machine learning on mobile devices using 5 aspects − latency, privacy, connectivity, size, and power consumption. It provides support on Android, iOS, embedded Linux and microcontrollers. Supports multiple languages such as Java, Swift, Objective C, C++, and Python. Also provides hardware acceleration and model optimization. The documentation provides end-to-end examples for machine learning projects such as image classification, object detection, question answering, pose estimation, text classification, and many more on different platforms. There are two aspects to ...

Read More

Kotlin Program to Generate Multiplication Table

AmitDiwan
AmitDiwan
Updated on 13-Oct-2022 1K+ Views

In this article, we will understand how to print a multiplication table. Multiplication table is created by iterating the required input 10 times using a for loop and multiplying the input value with numbers from 1 to 10 in each iteration. Below is a demonstration of the same − Suppose our input is − Input : 16 The desired output would be − The multiplication table of 16 is : 16 * 1 = 16 16 * 2 = 32 16 * 3 = 48 16 * 4 = 64 16 * 5 = 80 16 * 6 = ...

Read More

Kotlin Program to Round a Number to n Decimal Places

AmitDiwan
AmitDiwan
Updated on 13-Oct-2022 2K+ Views

In this article, we will understand how to round a number to n decimal places. Rounding of decimal values are done using the ceil() or floor() functions. Below is a demonstration of the same − Suppose our input is Input : 3.1415 The desired output would be − Output : 3.2 Algorithm Step 1 − START Step 2 − Declare a float value namely myInput. Step 3 − Define the values Step 4 − Use format() to alter the number of decimal places required. Store the result. Step 5 − Display the result Step 6 − Stop ...

Read More

Kotlin Program to calculate Simple Interest and Compound Interest

AmitDiwan
AmitDiwan
Updated on 13-Oct-2022 1K+ Views

In this article, we will input the Principal Amount, Rate and Time (Years) from the user to find the Simple Interest and Compound Interest − Simple Interest − The percentage interest on total principal amount. Returns are less compared to Compound Interest. Compound Interest − The percentage interest charged on principal and accrued interest. Rates are higher compared to Simple Interest. Below is a demonstration of the same − Suppose our input is − Principal = 25000.0 Annual Rate of Interest = 10.0 Time (years) = 4.0 The desired output would be − Simple Interest: 10000.0 Compound ...

Read More

Kotlin Program to Count the Number of Vowels and Consonants in a Sentence

AmitDiwan
AmitDiwan
Updated on 13-Oct-2022 1K+ Views

In this article, we will understand how to count the vowels and consonants in Kotlin. Alphabets that include the following are called Vowels − ‘a’ ‘e’ ‘i’ ‘o’ ‘u’ All other alphabets are called Consonants. Suppose our input is − Hello, my name is Charlie The desired output would be − The number of vowels in the statement is: 8 The number of vowels in the Consonants is: 12 Algorithm Step 1 − Start Step 2 − Declare two integers: vowelsCount, consonantsCount and a string input Step 3 − Define the values Step 4 − Run ...

Read More
Showing 19841–19850 of 25,466 articles
Advertisements