WAP to use Assignment Operator in Java
class Assignment
{
public static void main(String []arg)
{
int a=10;
int n;
System.out.println("Initial value of 'a' is: "+a);
//=Assignment Operator
n=a;
System.out.println("a value is assignment to n using =operator: "+n);
n+=a;
System.out.println("n using+=operator:"+n);
n-=a;
System.out.println("n using-=operator:"+n);
n*=a;
System.out.println("n using*=operator:"+n);
n/=a;
System.out.println("n using/=operator:"+n);
n%=a;
System.out.println("n using%=operator:"+n);
}
}
Comments
Post a Comment