#include < iostream >
using namespace std;
int main()
{
int a ;
int b ;
int result = 1 ;
a = 2 ;
b = 3 ;
result = a / b ;
cout << result << endl ;
return 0;
}
integerdeclaration.fashionandcs.com Integer type Variable: To store an integer type value we first declare a variable by using int and then stores an integer value in that variable. Actually int means integer type variable For example if we want to store 2 to a variable we will write the following program. #include < iostream > using namespace std; int main() { int a; a=2; return 0; } To display integer value stores in variable: And if you want to display this on compiler , write the following program #include < iostream > using namespace std; int main() { int a; a=2; cout << a << endl; return 0; } In this program the compiler will show 2 because we stored this on variable a Also We never uses " around a this is the reason that it will show 2 as output. If we use inverted commas " around a the compiler will show a as output.
Swapping of Variables: Swapping: Swapping of variables means Interchanging the values of variables Program: #include < iostream > using namespace std; int main() { int a = 10; int b = 20; int c; c = a; a = b; b = c; cout << a << " " << b << endl; return 0; }
Comments
Post a Comment