compairing No without Operator

S

sonu

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

so please any one help me and send some code


Thanks
Sonu
 
R

robin liu

What are you meaning? without any operator is without all operator included
+ - * / ?
 
C

CBFalconer

sonu said:
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/>
 
M

Mike Wahler

sonu said:
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
 
M

Mark McIntyre

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
 
M

Mark McIntyre

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?
Mark McIntyre
 
E

Eric Sosman

Mark said:
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).
 
R

Ravi Nakidi

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

Richard Bos

Ravi Nakidi said:
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
 
S

santosh

Ravi said:
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.
 
K

Keith Thompson

Ravi Nakidi said:
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:
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.
 
S

santosh

Keith said:
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.
 
M

Mark McIntyre

Mark said:
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).

Dang. You're right. :-(

Mark McIntyre
 
M

Mark McIntyre

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top