Monday, April 13, 2020

Assignment operators in C

  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("\n----------------ASSIGNMENT OPERATORS----------------");
 printf("\nEnter A and B values:");
 scanf("%d%d",&a,&b);
 printf("\n----------------ASSIGNMENT OPERATOR(=)----------------");
 printf("\nAssign operator is : A= %d, B=%d",a,b);
 printf("\n----------------ASSIGNMENT OPERATOR(+=)----------------");
 printf("\nIncrements then assign is : %d",a+=b);
 printf("\n----------------ASSIGNMENT OPERATOR(-=)----------------");
 printf("\nDecrements then assign is : %d",a-=b);
 printf("\n----------------ASSIGNMENT OPERATOR(*=)----------------");
 printf("\nMultiplies then assign is : %d",a*=b);
 printf("\n----------------ASSIGNMENT OPERATOR(/=)----------------");
 printf("\nDivides then assign is : %d",a/=b);
 printf("\n----------------ASSIGNMENT OPERATOR(%=)----------------");
 printf("\nModulus then assign is : %d",a%=b);
 getch();
}

  • Output :



No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...