30.12.20

C PROGRAM TO PERFORM ALL ASSIGNMENT OPERATORS AVAILABLE in c

#include <stdio.h>

#include <stdlib.h>

 

 

int main()

{

int a,c;

printf("enter a  value");

scanf("%d",&a);

c=a;

printf("value of c with operator = is %d\n",c);

c += a;

printf("value of c with operator += is %d\n",c);

c-=a;

printf("value of c with operator -= is %d\n",c);

c*=a;

printf("value of c with operator *= is %d\n",c);

c/=a;

printf("value of c with operator /= is %d\n",c);

c=200;

c%=a;

printf("value of c with operator %= is %d\n",c);

c<<=a;

printf("value of c with operator <<= is %d\n",c);

c>>=a;

printf("value of c with operator >>= is %d\n",c);

c&=a;

printf("value of c with operator &=  is %d\n",c);

c^=a;

printf("value of c with operator ^= is %d\n",c);

c|=a;

printf("value of c with operator |= = is %d\n",c);

 

    return 0;

}

OUTPUT

Enter a value 21

Value of c with operator = is 21

Value of c with operator += is 42

Value of c with operator -= is 21

Value of c with operator *= is 441

Value of c with operator /= is 21

Value of c with operator %= is 11

Value of c with operator <<= is 23068672

Value of c with operator >>= is 11

Value of c with operator &= is 1

Value of c with operator ^= is 20

Value of c with operator |= is 21

 


No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...