Wednesday, 8 December 2021

bitwise oprators

 project:_1

#include<stdio.h>

int main()
{
    int a, b;
    a=2;
    b=3;

    printf("a&b= %d\n", a&b);

    printf("a|b= %d\n", a|b);

    printf("a^b= %d\n", a^b);

    return 0;
}

// a=10 , b=11
// a&b= 10 (2)
// a|b= 11 (3)
// a^b= 01 (1)

project:_2
#include<stdio.h>
int main()
{
    int a,b,c;
    a=1;
    b=2;
    c=3;
   
printf("A&B&C will be= %d\n",a&b&c);

    printf("A|B|C will be= %d\n",a|b|c);

    printf("A^B will be= %d\n",a^b);

    printf("B^C will be= %d\n",b^c);

    printf("A^C will be= %d\n",a^c);

    return 0;


}

// a= 1 (01)
// b= 2 (10)
// c= 3 (11)
A&B&C will be= 0
A|B|C will be= 3
A^B will be= 3
B^C will be= 1
A^C will be= 2

// project:_11 (bitwise oprators)
#include <stdio.h>
int main()
{
    int a,b,c;
    printf ("enter the first number: ");
    scanf ("%d",&a);

    printf ("enter the second number: ");
    scanf ("%d",&b);

    printf ("enter the third number: ");
    scanf ("%d",&c);

    printf ("binary value of a,b&c will be: %d\n", a&b&c);
    printf ("binary value of either a or b or c will be: %d\n", a|b|c);
    printf ("exclusive binary value a&b will be: %d\n", a^b);
    printf ("exclusive binary value a&c will be: %d\n", a^c);
    printf ("exclusive binary value b&c will be: %d\n", b^c);
    return 0;
}
// output:_
// in binary a= 01, b=10, c= 11
// A&B&C =00 (0)
// A|B|C =11 (3)
// A^B =11 (3)
// A^c = 10 (2)
// B^C =01 (1)



   

No comments:

Post a Comment

here we are to help you.you can watch videos and get information about :- (1) scientific facts (2) education (3) gaming (4) music (5) lyrics (6) cartoons and many more.So keep watching keep learning, thank you.

Recurtions

  //Why are recursions? //We can solve difficult long iteratively can be solved simply recursively. // there are some problems which suite...