long c++

Long c++ is program in c++ which is used to take twice as much as memory is long. In different systems the specification of allocated memory space is differ. On Linux environment long takes 64 bit which is also equals to 8 byte of space. On other hand the long long takes 128 bit which is equals to 16 bytes of space. When we take some larger values of intergers, we need this function.

Below is the C++ program to implement the above approach:

on Jun 17, 2022
// C++ program to implement
// the above approach
#include <iostream>
using namespace std;
 
// Driver code
int main()
{
    // Value of p 10^5
    int p = 100000;
 
    // Value of q 10^5
    int q = 100000;
 
    long long int result = (long long int)p * q;
    cout << result << endl;
    return 0;
}

Add Comment

0

Below is the C++ program to demonstrate how converting int to long long affects the output:

on Jun 17, 2022
// C++ program to implement
// the above approach
#include <iostream>
using namespace std;
 
// Driver code
int main()
{
    // Value of p 10^5
    int p = 100000;
 
    // Value of q 10^5
    int q = 100000;
 
    long long int result = p * q;
    cout << result << endl;
    return 0;
}

Add Comment

0

In various competitive coding platforms, the constraints are between 107 to 1018. Below is the program to understand the concept:

on Jun 17, 2022
// C++ program to implement
// the above approach
#include <iostream>
using namespace std;
 
// Driver code
int main()
{
    // Value of p 10^5
    int p = 100000;
 
    // Value of q 10^5
    int q = 100000;
 
    int result = p * q;
    cout << result << endl;
    return 0;
}

Add Comment

0

All the possible answer of your questions are given above. You can also delivered your important suggestion.

C++ answers related to "long c++"

View All C++ queries

C++ queries related to "long c++"

Browse Other Code Languages

CodeProZone