Wednesday, 8 December 2021

relational oprators

project:-1
#include<stdio.h>
int main()
{
    int a, b;
    a=75, b=5;

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

    return 0;
}

project:_2
#include<stdio.h>
int main()
{
   int a, b;
   a=49;
   b=48;

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

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

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

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

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

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

   return 0;

}

results:_
A==B =0
A!=B =1
A>B =1
A<B =0
A>=B =1
A<=B =0

(here 1 represents true & 2 represents false.)

// relational oprator:- ==,!=,>=,<=
// if both are equal/greater then /less then/greater then or equals
to/less then or equals to then a+b will be 1
// if not then a+b will be 0

// project_8 (relational oprators)
// project:_9 (password match or not)
#include <stdio.h>
int main()
{
    int a,b;
    printf ("enter the first number: ");
    scanf ("%d",&a);

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

    printf ("both numbers are equal: %d\n", a==b);
    printf ("both numbers aren't equal: %d\n", a!=b);
    printf ("does a is greater then b: %d\n", a>b);
    printf ("does a is less then b: %d\n", a<b);
    printf ("does a is greater then or equals to b: %d\n", a>=b);
    printf ("does a is less then equals to b: %d\n", a<=b);

    return 0;
}
output:_
enter the first number: 7 enter the second number: 4 both numbers are equal: 0 both numbers aren't equal: 1 does a is greater then b: 1 does a is less then b: 0 does a is greater then or equals to b: 1 does a is less then equals to b: 0
// here 1=true & 0=false

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...