Posts
Data Type in C++.
- Get link
- X
- Other Apps
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)...
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; } }