Wednesday, 8 December 2021

logical oprators

 project:_1

#include<stdio.h>

int main()
{
    int a, b;
    a= 50, b=0;

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

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

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

    printf("A!B= %d\n", !b);


    return 0;
}

project:_2
#include<stdio.h>
int main()

{
    int a, b,c;
    a=25;
    b=5;
    c=0;

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

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

    printf("not A will be= %d\n", !a);

    printf("not B will be= %d\n",!b);

    printf("not C will be= %d\n",!c);

    return 0;
   
}

// logical oprator:- &&,||,!

// project:_10 (logical 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 ("does both a&b&c are natural numbers: %d\n", a&&b&&c);
    printf ("does either a or b or c are natural numbers: %d\n", a||b||c);
    printf ("does a isn't a natural number: %d\n", !a);
    printf ("does b isn't a natural number: %d\n", !b);
    printf ("does c isn't a natural number: %d\n", !c);

    return 0;
}
output:_
enter the first number: 4 enter the second number: 2 enter the third number: 1 does both a&b&c are natural numbers: 1 does either a or b or c are natural numbers: 1 does a isn't a natural number: 0 does b isn't a natural number: 0 does c isn't a natural number: 0 PS E:\c programming> cd "e:\c programming\" ; if ($?) { gcc new.c -o new } ; if ($?) { .\new } enter the first number: 4 enter the second number: 2 enter the third number: 0 does both a&b&c are natural numbers: 0 does either a or b or c are natural numbers: 1 does a isn't a natural number: 0 does b isn't a natural number: 0 does c isn't a natural number: 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...