Java Codes
- Get link
- X
- Other Apps
addition program in java
import java.util.Scanner;
public class AddTwoNumbers
{
public static void main(String[] args)
{
int num1, num2, sum;
Scanner sc = new Scanner(System.in);
System.out.println("First number : ");
num1 = sc.nextInt();
System.out.println("Second number : ");
num2 = sc.nextInt();
sum = addTwo(num1, num2);
System.out.println("Sum : " + sum);
sc.close();
}
public static int addTwo(int a, int b)
{
int sum = a + b;
return sum;
}
}
- Get link
- X
- Other Apps
Popular posts from this blog
Kotlin
C++
C++ is a general purpose programming language and widely used now a days for competitive programming. It has imperative, object-oriented and generic programming features. C++ runs on lots of platform like Windows, Linux, Unix, Mac etc. C++ is a popular programming language. C++ is used to create computer programs. Example #include <iostream> using namespace std; int main() { cout << "Hello World!" ; return 0 ; }
Data Type in C++.
C++ All data type in C++ are here.. #include<iostream> using namespace std; int main() { cout << "Size of char : " << sizeof(char) << " byte" << endl; cout << "Size of int : " << sizeof(int) << " bytes" << endl; cout << "Size of short int : " << sizeof(short int) << " bytes" << endl; cout << "Size of long int : " << sizeof(long int) << " bytes" << endl; cout << "Size of signed long int : " << sizeof(signed long int) << " bytes" << endl; cout << "Size of unsigned long int : " << sizeof(unsigned long int) << " bytes" << endl; cout << "Size of float : " << sizeof(float)...
Comments
Post a Comment