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<iostream.h> //standard input/output header file

#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.

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<stdio.h> //standard input/output header file

#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.