Add two numbers in Scala - The Coding Shala
Home >> Learn Scala >> Add Two Numbers
Other Posts You May Like
In this post, we will learn how to write a Scala program to Add Two Numbers.
Add Two Numbers in Scala
The following is the Scala program to Add two Numbers.
Scala Program:
//add two numbers in scala //the coding shala object Main { def main(args: Array[String]){ //we can take user input also val num1 = 10; val num2 = 20; //add both numbers val result = num1 + num2; println("Sum of " + num1 + " + " + num2 + " = " + result); } }
- Scala - Hello World Program
- Java - Hello World Program
- Power of Two
- Simple XML Validator
- Fibonacci Series
Comments
Post a Comment