c++ help

Can anyone tell me how this code is working ?
what is long int ?
[code]
#include<stdio.h>
int main(){

long int decimalNumber;

printf("Enter any decimal number : ");
scanf("%d",&decimalNumber);

printf("Equivalent octal number is: %o",decimalNumber);

return 0;
}

Last edited on
what is long int ?
Last edited on
That is a numerical type which holds a specific range of numbers.

You can use numeric_limits in order to find out what range that is:

http://www.cplusplus.com/reference/limits/numeric_limits/?kw=numeric_limits

1
2
3
4
5
6
7
8
9
// numeric_limits example
#include <iostream>     // std::cout
#include <limits>       // std::numeric_limits

int main () {
  std::cout << "Minimum value for long int: " << std::numeric_limits<long int>::min() << '\n';
  std::cout << "Maximum value for long int: " << std::numeric_limits<long int>::max() << '\n';
  return 0;
}
Example output:
Minimum value for long int: -9223372036854775808
Maximum value for long int: 9223372036854775807
Topic archived. No new replies allowed.