Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

compairing No without Operator

0 views
Skip to first unread message

sonu

unread,
Mar 16, 2006, 12:56:08 AM3/16/06
to
Hi i want to find the greater number without any operator.

so please any one help me and send some code


Thanks
Sonu

robin liu

unread,
Mar 16, 2006, 1:23:35 AM3/16/06
to
What are you meaning? without any operator is without all operator included
+ - * / ?


"sonu" <sanjaykum...@gmail.com> ????
news:1142488568....@u72g2000cwu.googlegroups.com...

Keith Thompson

unread,
Mar 16, 2006, 1:41:17 AM3/16/06
to
"sonu" <sanjaykum...@gmail.com> writes:
> Hi i want to find the greater number without any operator.

Why?

> so please any one help me and send some code

Again, why?

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

Ian Collins

unread,
Mar 16, 2006, 2:05:40 AM3/16/06
to
sonu wrote:
> Hi i want to find the greater number without any operator.
>
> so please any one help me and send some code
>
Any? Please elaborate.

--
Ian Collins.

CBFalconer

unread,
Mar 16, 2006, 5:00:05 AM3/16/06
to
sonu wrote:
>
> Hi i want to find the greater number without any operator.
>
> so please any one help me and send some code

Here is some code. All you have to do is decode it.

rprbc rprbd rprca rprcb rprcd rprda rprdb
rprdc
rraaa rraab rraac rraad rraap rraba rrabb
rrabc
rrabd rrabp rraca rracb rracd rracp rrada
rradb
rradc rradp rrapa rrapb rrapc rrapd rrbaa
rrbab
rrbac rrbad rrbap rrbba rrbbc rrbbd rrbbp
rrbca
rrbcb rrbcd rrbcp rrbda rrbdb rrbdc rrbdp
rrbpa
rrbpb rrbpc rrbpd rrcaa rrcab rrcad rrcap
rrcba
rrcbb rrcbd rrcbp rrcda rrcdb rrcdp rrcpa
rrcpb
rrcpd rrdaa rrdab rrdac rrdap rrdba rrdbb
rrdbc
rrdbp rrdca rrdcb rrdcp rrdpa rrdpb rrdpc
rrpaa
rrpab rrpac rrpad rrpba rrpbb rrpbc rrpbd
rrpca

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

Eric Sosman

unread,
Mar 16, 2006, 8:33:47 AM3/16/06
to
sonu wrote:

> Hi i want to find the greater number without any operator.

Your desires are very peculiar. Have you sought treatment?

--
Eric Sosman
eso...@acm-dot-org.invalid

Mike Wahler

unread,
Mar 16, 2006, 11:39:34 AM3/16/06
to
"sonu" <sanjaykum...@gmail.com> wrote in message
news:1142488568....@u72g2000cwu.googlegroups.com...

> Hi i want to find the greater number without any operator.

With my telephone service provider, dialing the
number zero connects me with an operator. Dialing
any of the other (greater) numbers (one through nine)
does not.

So you easily can find a greater number without any
operator: See your telephone set, and choose one other
than zero.

> so please any one help me and send some code

Some code:

int main()
{
return 0;
}

-Mike


Mark McIntyre

unread,
Mar 16, 2006, 5:52:53 PM3/16/06
to
On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
<sanjaykum...@gmail.com> wrote:

>Hi i want to find the greater number without any operator.

The list of operators in C is extensive:
+ - * / % = . -> > < <= >= == != >> << ++ -- [] & | ^ && || ?:
sizeof and (typename) *= += -= /= <<= >>= &= |= ^=

and probably a few more. I suspect it'd be fairly hard to do anything
without /some/ of them.

I suspect you need to specify the list of operators your teacher has
banned.
Mark McIntyre
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

Mark McIntyre

unread,
Mar 16, 2006, 6:01:14 PM3/16/06
to
On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
<sanjaykum...@gmail.com> wrote:

>Hi i want to find the greater number without any operator.

I may have it.

#include <stdio.h>
int main(void)
{
char x[12], y[12];
printf("please enter two numbers, the larger first\n");
scanf("%s %s",x, y);
printf("%s is larger\n", x);
return 0;
}

The square brackets aren't operators in that context. However if you
object to that picked nit, this also works:

#include <stdio.h>
int main(void)
{
printf("please enter two numbers, the larger first\n");
getchar();
printf("the first one is larger\n");
return 0;
}

Do I win a prize?

Eric Sosman

unread,
Mar 16, 2006, 9:40:11 PM3/16/06
to
Mark McIntyre wrote:
> On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
> <sanjaykum...@gmail.com> wrote:
>
>
>>Hi i want to find the greater number without any operator.
>
>
> I may have it.
>
> #include <stdio.h>
> int main(void)
> {
> char x[12], y[12];
> printf("please enter two numbers, the larger first\n");

This uses the () operator to call printf (the parens
are described as a "postfix operator" in 6.5.2).

--
Eric Sosman
eso...@acm-dot-org.invalid

Ravi Nakidi

unread,
Mar 17, 2006, 5:35:12 AM3/17/06
to
Hi Sonu,

This is the one solution

#include<stdio.h>

main()
{

printf("Enter two numbers:");

scanf("%d"%d",&a,&b);

if(a/b){
if(b/a)
printf("Both are equal");
else
printf("%d is big",a);
}
else
printf("%d is big",b);

}


I think this is the solution u are expecting.

Regards,
Ravi Nakidi,
S/w Engineer,
Tally Solutions Pvt Ltd,
Bangalore-76.

Richard Bos

unread,
Mar 17, 2006, 6:38:18 AM3/17/06
to
"Ravi Nakidi" <lavi...@gmail.com> wrote:

> This is the one solution

Solution to _what_? Learn to quote context, confound you, or get off of
Google Broken Beta and onto a real news server and real news client.

> #include<stdio.h>
>
> main()
> {
>
> printf("Enter two numbers:");
>
> scanf("%d"%d",&a,&b);

You haven't declared a and b. Your string is broken. Using scanf() like
this is good enough for a one-shot program, but not for anything
serious; for a start, you should check for errors.

> if(a/b){
> if(b/a)
> printf("Both are equal");
> else
> printf("%d is big",a);
> }
> else
> printf("%d is big",b);

There are at least two problems with this. First, since you use %d, a
and b are clearly signed integers, and therefore equating "is big" with
a normal comparison is dubious. Second, even were a and b unsigned, what
happens if a or b equals 0?

> }
>
> I think this is the solution u are expecting.

I have no idea who this Mr. u is of whom you speak. However, I think
you'll find that both () and, as probably even the OP's teacher will
realise, / are operators, so the OP cannot use your solution.

Richard

Ravi Nakidi

unread,
Mar 17, 2006, 6:55:32 AM3/17/06
to
Thanx

santosh

unread,
Mar 17, 2006, 12:45:33 PM3/17/06
to
Ravi Nakidi wrote:
> Hi Sonu,
Please quote context.

> This is the one solution
>
>
>

Trim excess linefeeds before posting.

> #include<stdio.h>
> main()

Correct forms of main() are either 'int main(void)' or 'int main(int
argc, char **argv)'.

> {
> printf("Enter two numbers:");

Either use a newline sequence at the end of the string or call
fflush(stdout) immediatly after the printf() call, to ensure that your
prompt is sent to stdout.

> scanf("%d"%d",&a,&b);

You haven't declared 'a' and 'b'. Your format string is also wrong. You
might want "%d %d" assuming a and b are integers.

>
> if(a/b){
> if(b/a)
> printf("Both are equal");

Not neccessarily.

Keith Thompson

unread,
Mar 17, 2006, 1:43:19 PM3/17/06
to
"Ravi Nakidi" <lavi...@gmail.com> writes:
> This is the one solution
>
>
>
> #include<stdio.h>
>
> main()
> {
>
> printf("Enter two numbers:");
>
> scanf("%d"%d",&a,&b);
>
> if(a/b){
> if(b/a)
> printf("Both are equal");
> else
> printf("%d is big",a);
> }
> else
> printf("%d is big",b);
>
> }
>
>
> I think this is the solution u are expecting.

Ravi, I'm going to offer you some advice.

This is not Google Groups. This is Usenet, a discussion network
that's been around for many many years. Google provides an interface
to it, one that has some serious problems.

Look closely at this followup. The lines starting with "> " are
quoted from the previous article. They provide context so people can
see what I'm talking about without going back to the previous article
(which isn't always possible).The line at the top:
"Ravi Nakidi" <lavi...@gmail.com> writes:
is an attribution line; it indicates who who wrote the quoted text, so
readers can follow the conversation more easily.

The biggest flaw of the Google Groups interface to Usenet is that it
encourages users to post followups without context. For those of us
using other interfaces, this makes it very difficult to follow what
you're saying. For example, in your article you offered a solution,
but there was no indication of what the problem was.

Fortunately, there is an easy workaround. Please read
<http://cfaj.freeshell.org/google/>. It explains how and why to post
properly using the Google interface, and provides links to some more
useful information. Please read and understand it *before* you post
another followup here.

Abbreviations like "u" for "you" are strongly frowned upon here. This
is not a chatroom or an SMS service. A lot of people here have real
difficulty understanding these kinds of abbreviations, either because
English isn't their native language or for other reasons. A lot more
of us just find them annoying. If you don't take the time to spell
out simple words like "you" and "your", you will not be taken
seriously here.

Some of the regulars have put together an introduction to the
newsgroup. It's at
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>.
I highly recommend it.

Nobody is going to force you to follow this advice, but if you don't,
a lot of people are going to killfile you (i.e., configure their
newsreaders so they never see your posts again), and you won't be able
to participate here in any meaningful way.

You've gotten a lot of angry responses, and it may seem like overkill,
but there are reasons for it. First, Usenet is inherently
asynchronous, and many of the posters hasn't seen the other followups
when they posted their own. Second, we've gotten literally hundreds
of people coming here and posting followups without context, thanks to
the Google interface; it's not really their fault, but it gets
frustating.

Finally, let's look at the code you posted. The idea is reasonably
clever, but it doesn't meet the orginal requirements (the question
asked for a solution with no operators, and you used the "/"
operator), it doesn't work (consider what happens if either number is
0), and it doesn't even compile (you didn't declare a or b). If
you're going to post a program here, you should take the time to try
it yourself first. Compile it, run it, and post the *exact* code that
you fed to the compiler. And if people point out errors, even minor
and seemingly irrelevant ones, don't take it personally; it's great
way to learn.

Welcome to comp.lang.c. I hope you find it useful and enjoyable.

santosh

unread,
Mar 17, 2006, 1:52:05 PM3/17/06
to
Keith Thompson wrote:

> "Ravi Nakidi" <lavi...@gmail.com> writes:
> Ravi, I'm going to offer you some advice.
[snip helpful advice]

> Welcome to comp.lang.c. I hope you find it useful and enjoyable.

I laud your patient efforts, though in this instance, I very much doubt
that they are not wasted.

Mark McIntyre

unread,
Mar 17, 2006, 7:01:44 PM3/17/06
to

Dang. You're right. :-(

Mark McIntyre

unread,
Mar 17, 2006, 7:02:44 PM3/17/06
to
On 17 Mar 2006 02:35:12 -0800, in comp.lang.c , "Ravi Nakidi"
<lavi...@gmail.com> wrote:

>Hi Sonu,
>
>This is the one solution
>
>
>
>#include<stdio.h>
>
>main()
>{
>
> printf("Enter two numbers:");
>
> scanf("%d"%d",&a,&b);
>
> if(a/b){

/ is an operator.

0 new messages