## Write a C++ program to show the use of modulus C++ shorthand operator.

Q12. Write a C++ program to show the use of modulus C++ shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

//’%'(mod) is used to return remainder of division

m%=2; //equivalent to m=m%2;

cout<<“\n The value of M is “<<m<<“.”;

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 0.

## Write a C++program to show the use of division C++ shorthand operator.

Q11. Write a C++ program to show the use of division C++ shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m/=2; //equivalent to m=m/2;

cout<<“\n The value of M is “<<m<<“.”;

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 5.

## Write a C++ program to show the use of multiply C++ shorthand operator.

Q10. Write a C++ program to show the use of multiply C++ shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m*=2; //equivalent to m=m*2;

cout<<“\n The value of M is “<<m<<“.”;

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 20.

## Write a C++ program to show the use of subtraction C++ shorthand operator.

Q9. Write a C++ program to show the use of subtraction C++ shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m-=2; //equivalent to m=m-2;

cout<<“\n The value of M is “<<m<<“.”;

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 8.

## Write a C++ program to show the use of addition C++ shorthand operator.

Q8. Write a C++ program to show the use of addition C++ shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m+=2; //equivalent to m=m+2;

cout<<“\n The value of M is “<<m<<“.”;

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 12.

## C Program To Show The Use Of Division C Shorthand Operator.

Q11. Write a C program to show the use of division C shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m/=2; //equivalent to m=m/2;

printf(“\n The value of M is %d.”,m);

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 5.

## C Program To Show The Use Of Multiply C Shorthand Operator.

Q10. Write a C program to show the use of multiply C shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m*=2; //equivalent to m=m*2;

printf(“\n The value of M is %d.”,m);

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 20.

## C Program To Show The Use Of Subtraction C Shorthand Operator.

Q9. Write a C program to show the use of subtraction C shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m-=2; //equivalent to m=m-2;

printf(“\n The value of M is %d.”,m);

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 8.

## C Program To Show The Use Of Addition C Shorthand Operator.

Q8. Write a C program to show the use of addition C shorthand operator.

Solution:

#include<conio.h> //for clrscr()

int main()

{

int m;

clrscr(); //for clearing the screen

m=10;

m+=2; //equivalent to m=m+2;

printf(“\n The value of M is %d.”,m);

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

OUTPUT:

The value of M is 12.

# Q37. Define C++ Shorthand.

Ans. A way to combining an arithmetic operator and an assignment operator.