+ 2

Can I use negative integers?

10th Jul 2016, 3:00 AM
CODER
CODER - avatar
4 Respostas
+ 4
yes, unless it's unsigned.
13th Jul 2016, 8:28 PM
Björn Sundin
0
actually, suppose if we write int a=-25, then compiler accepted.. if we write unsigned int a=-29 or int a=-29, then compiler was not accepted because unsigned means not use any subtraction (-)...
18th Jul 2016, 8:18 AM
meherDev
meherDev - avatar
0
obviously..... by using unsigned.....
27th Dec 2016, 3:59 PM
Subham Mandal
Subham Mandal - avatar
- 3
#include<iostream> using namespace std; int main() { int a=5, b=-2, x; x=a+b; cout<<"x= "<<x<<endl; return 0; } output: x=3
18th Jul 2016, 8:34 AM
meherDev
meherDev - avatar