+ 2
Can I use negative integers?
4 Réponses
+ 4
yes, unless it's unsigned.
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 (-)...
0
obviously.....
by using unsigned.....
- 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