Posts
Showing posts from August, 2021
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; } }
C++
- Get link
- X
- Other Apps
Traveled_Day_And_Week # include < iostream > using namespace std ; const int DAY_IN_A_WEEK = 7 ; int main (){ int dayTraveled ; int fullweeks , remainingDayas ; cout << " plase Enter number of day you travels : " << endl ; cin >> dayTraveled ; fullweeks = dayTraveled / DAY_IN_A_WEEK ; remainingDayas = dayTraveled % DAY_IN_A_WEEK ; cout << dayTraveled << " days and " << fullweeks << " weeks and " << remainingDayas << " days " << endl ; return 0 ; }