# Thread: how to calculate billion number

1. ## how to calculate billion number

i want write program to calculate billion number but when i input a lot of number my program will show negative number

this my code

Code:
```int main()
{
double long a,b,c;

scanf ("%d",&a);
scanf ("%d",&b);
c=a+b;
printf("%d",c);

getch();
}```
why don't work?

plz help me

ps.sorry my eng is not strong.

2. Because normal 32 bit integers (the most common) have a max positive value of 2147483647

If you want something much bigger, tell us which compiler you're using.

3. i use turbo c++

thx for u help

4. >i use turbo c++
Start by getting a newer compiler. Do you have any idea how old Turbo C++ is?

5. i think it came out in '91

6. Exactly. For starters, use a long instead of an int.

7. int can only hold values of -32,768 through 32,767. Try compling this bit of code (Taken from SAMS Teach Yourself C++ In 24 Hours)
Code:
```#include <iostream>

int main()
{
int smallNumber;
smallNumber = 32767;
std::cout << "small number:" << smallNumber << std::endl;
smallNumber++;
std::cout << "small number" << smallNumber << std::endl;
smallNumber++;
std::cout << "small number" << smallNumber << std::endl;
return 0;

}```
When you see the output, you will notice that after I increment the number with ++, it wraps around to the smallest number it can hold, which is -32767. This is called (you guessed it) "Wrap Around." Use an unsigned long int for positive #s up to 4,294,967,295. Hope it helps, a fellow n00b programmer, Sintu

8. How about a 'long long int' or is this not standard.

9. long long isn't standard but it's reasonably well supported I think.

10. Not on the OP's fossil compiler it isn't.