Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Saandeep Sreerambatla

    @saandeep-sreerambatla-hWHU1M Oct 8, 2009

    A small idea to find whether greater or smaller.

    if (x/y)
    Printf ("X is greater")
    else
    Printf("y is greater")


    This is a small idea ,i dont know how to check for equal case.

    *thinking*

  • yadavundertaker mohit

    @yadavundertaker-0p3HBs Oct 8, 2009

    if(x/y==1)
    {
    printf("x=y");
    else
    {
    if(x/y==0)
    printf("y is greater");
    else
    printf("x is greater");
    }
    }

  • vignesh1988i

    @vignesh1988i-uWq8hQ Oct 8, 2009

    HMMMM... πŸ˜€ ok.. think think ..... for the second person ok... u have tried .. good.. '==' is is also a relational operator.......😎😎😎

  • arun.aj

    @arunaj-OPUrll Oct 9, 2009

    /*a and b declared and defined*/
    if(!(a-b))printf("equal");
    else if(a/b)printf("a is greater");
    else printf("b is greater");

    πŸ˜‰

  • Saandeep Sreerambatla

    @saandeep-sreerambatla-hWHU1M Oct 9, 2009

    arun.aj/*a and b declared and defined*/
    if(!(a-b))printf("equal");
    if(a/b)printf("a is greater");
    else printf("b is greater");

    πŸ˜‰


    Good one dude πŸ˜€

  • yadavundertaker mohit

    @yadavundertaker-0p3HBs Oct 9, 2009

    arun.aj/*a and b declared and defined*/
    if(!(a-b))printf("equal");
    else if(a/b)printf("a is greater");
    else printf("b is greater");

    πŸ˜‰


    you have IQ like shikamaru...so you are his fan...

    great...

  • yadavundertaker mohit

    @yadavundertaker-0p3HBs Oct 9, 2009

    vignesh1988iHMMMM... πŸ˜€ ok.. think think ..... for the second person ok... u have tried .. good.. '==' is is also a relational operator.......😎😎😎


    thanks for telling ....i have a tight hand in C..

  • Sahithi Pallavi

    @sahithi-oJZaYj Oct 9, 2009

    arun.aj/*a and b declared and defined*/
    if(!(a-b))printf("equal");
    else if(a/b)printf("a is greater");
    else printf("b is greater");

    πŸ˜‰


    wonderfull !! Good one..

  • arun.aj

    @arunaj-OPUrll Oct 9, 2009

    yadavundertakeryou have IQ like shikamaru...so you are his fan...

    great...

    lol!! just a fan πŸ˜€

  • vignesh1988i

    @vignesh1988i-uWq8hQ Oct 9, 2009

    hmmmm... keep it up... πŸ˜€πŸ˜Ž cool,,, so the next constraint for the same problem am gonna give u....

    without using '/' operator how will u do???😲

  • arun.aj

    @arunaj-OPUrll Oct 9, 2009

    /*declaring defining a and b... using stdio.h and stdlib.h*/
    /*brute force πŸ˜€*/
    if(!(a-b)){printf("equal"); exit(0);}
    while(a && b)
    {
    a--;b--;
    }
    if(a)printf("a is greater");
    else printf("b is greater");

    πŸ˜€

  • vignesh1988i

    @vignesh1988i-uWq8hQ Oct 9, 2009

    Hmmmm ..... very good man.... good good πŸ˜€ πŸ˜€ so the next constraint , ok by using single if statement how will u do??? in a single 'if' we can finish comparing.... 😎😎

  • Sahithi Pallavi

    @sahithi-oJZaYj Oct 10, 2009

    arun.aj/*declaring defining a and b... using stdio.h and stdlib.h*/
    /*brute force πŸ˜€*/
    if(!(a-b)){printf("equal"); exit(0);}
    while(a && b)
    {
    a--;b--;
    }
    if(a)printf("a is greater");
    else printf("b is greater");

    πŸ˜€

    Awesome man..! Great one..! 😁