Found 33676 Articles for Programming

Kotlin Program to Multiply Two Floating-Point Numbers

AmitDiwan
Updated on 13-Oct-2022 12:34:58

2K+ Views

In this article, we will understand how to multiply two floating-point numbers. A floating-point number, is a positive or negative whole number with a decimal point. There are two types of floating point in Kotlin Float Double Below is a demonstration of the same − Suppose our input is val1: 10.5 val2: 45.0 The desired output would be The product is: 472.5 Algorithm Step 1 − Start Step 2 − Declare three floating points: val1, val2 and product Step 3 − Define the floating-point values Step 4 − Read the values Step 5 − Multiply ... Read More

Kotlin Program to Read The Number From Standard Input

AmitDiwan
Updated on 13-Oct-2022 12:28:31

465 Views

In this article, we will understand how to read a number from standard input in Kotlin. The ‘nextInt’ method is used to read the number. Below is a demonstration of the same Suppose our input is 45 The desired output would be The input value is 45 Algorithm Step 1 − Start Step 2 − Declare an integer: value Step 3 − Define the integer Step 4 − Read the values Step 5 − Display the value Step 6 − Stop Example 1 In this example, we will read the number from the standard input using ... Read More

Kotlin Program to Swap Two Numbers

AmitDiwan
Updated on 13-Oct-2022 12:26:30

1K+ Views

In this article, we will understand how to how to swap two numbers in Kotlin. This is done using a temporary variable. Below is a demonstration of the same Suppose our input is val1 : 45 val2 : 60 The desired output would be val1 : 60 val2 : 45 Algorithm Step 1 − Start Step 2 − Declare three integers: val1, val2 and tempVal Step 3 − Define the values Step 4 − Assign val1 to temporary variable Step 5 − Assign val2 to val1 Step 6 − Assign temporary tempVal variable to val2 Step 7 ... Read More

Kotlin Program to Add two Numbers

AmitDiwan
Updated on 13-Oct-2022 12:24:26

5K+ Views

In this article, we will understand how to add two numbers. This can be done using the ‘+’ operator. Below is a demonstration of the same Suppose our input is input1 : 10 input2 : 15 The desired output would be Sum : 25 Algorithm Step 1 − Start Step 2 − Declare three integers: val1, val2 and sum Step 3 − Define the integers Step 4 − Add the two values using an addition operator (+) Step 5 − Display the result Step 6 − Stop Example 1 In this example, we will add two numbers ... Read More

Kotlin Program to Print a String

AmitDiwan
Updated on 13-Oct-2022 12:22:15

648 Views

In this article, we will understand how to print a string. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Below is a demonstration of the same Suppose our input is − Hello my name is John! The desired output would be The string is: Hello my name is John! Algorithm Step 1 − START Step 2 − Define a string variable Step 3 − Display the string on the console Step 4 − STOP Example 1 In this example, we will print a string using the print() ... Read More

Kotlin Program to Print an Integer

AmitDiwan
Updated on 13-Oct-2022 12:19:29

659 Views

In this article, we will understand how to print an integer. Integer is a primitive data type that contains numbers up to 32 bits. Below is a demonstration of the same − Suppose our input is − 45 The desired output would be − The integer is: 45 Algorithm Step 1 − START Step 2 − Define the integer value in a variable Step 3 − Display it on the console Step 4 − STOP Example 1 In this example, we will simply print an integer using the print() method. First, declare an integer variable, which ... Read More

Hello World program in Kotlin

AmitDiwan
Updated on 13-Oct-2022 12:15:46

505 Views

In this article, we will understand how to print hello world in Kotlin. Hello world is stored as a string format and is printed using ‘print()’ function. Input Suppose our input is Hello World Output The expected out should be Hello World Algorithm Step 1 − START Step 2 − Define a string variable Step 3 − Display the string on the console Step 4 − STOP Example 1 In this example, we will simply display a string “Hello World” using the print() method in Kotlin − fun main() { val inputStr = ... Read More

Top 10 Reasons to Learn Python for Big Data

Vikram Chiluka
Updated on 12-Oct-2022 12:14:34

386 Views

What is Big Data? Big Data is a massive collection of data that is growing exponentially over time. It is a data set that is so large and complex that traditional data management tools cannot store or process it efficiently. Big data is a type of data that is extremely large in size. Python is the ideal programming language for Big Data due to its ease of use and statistical analysis capabilities. Python is a rapidly growing programming language, and a combination of Python and Big Data is the most popular choice among developers due to its low coding requirements ... Read More

Python libraries to be used for visualization

Vikram Chiluka
Updated on 12-Oct-2022 12:12:05

499 Views

In this article, we will show you various Python libraries for visualization and their features. In today's day and age, viewing the results of our analysis and inferring results is often more convenient than going through textual data or CSV files to understand the results. As a result, data visualization is an easy way to find answers to complex questions. It also allows users to express their results more effectively than tables do. Data Visualization in Python Python provides several plotting libraries, including Matplotlib, Seaborn, and many other data visualization packages, each with unique features for creating informative, customized, and ... Read More

How to convert a dictionary to a matrix or nArray in Python?

Vikram Chiluka
Updated on 12-Oct-2022 12:09:29

18K+ Views

In this article, we will show you how to convert a dictionary to a matrix or a NumPy array using the array() function of the NumPy library in python. It is sometimes necessary to convert a dictionary in Python into a NumPy array, and Python provides an efficient way of doing so. Converting a dictionary to a NumPy array gives an array containing the key-value pairs in the dictionary. In this section, we will look at examples of converting various types of dictionaries to a NumPy array in Python Converting a Dictionary to a Numpy Array Converting a Nested ... Read More

Advertisements