What are you meaning? without any operator is without all operator included
+ - * / ?
"sonu" <sanjaykumar.ba rick@gmail.com> ????
news:1142488568 .063603.7170@u7 2g2000cwu.googl egroups.com...[color=blue]
> Hi i want to find the greater number without any operator.
>
> so please any one help me and send some code
>
>
> Thanks
> Sonu
>[/color]
"sonu" <sanjaykumar.ba rick@gmail.com> writes:[color=blue]
> Hi i want to find the greater number without any operator.[/color]
Why?
[color=blue]
> so please any one help me and send some code[/color]
Again, why?
--
Keith Thompson (The_Other_Keit h) kst-u@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.
sonu wrote:[color=blue]
> Hi i want to find the greater number without any operator.
>
> so please any one help me and send some code
>[/color]
Any? Please elaborate.
--
"If you want to post a followup via groups.google.c om, 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/googlegroupsrep ly/>
"sonu" <sanjaykumar.ba rick@gmail.com> wrote in message
news:1142488568 .063603.7170@u7 2g2000cwu.googl egroups.com...[color=blue]
> Hi i want to find the greater number without any operator.[/color]
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.
[color=blue]
> so please any one help me and send some code[/color]
On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
<sanjaykumar.ba rick@gmail.com> wrote:
[color=blue]
>Hi i want to find the greater number without any operator.[/color]
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
On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
<sanjaykumar.ba rick@gmail.com> wrote:
[color=blue]
>Hi i want to find the greater number without any operator.[/color]
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
--
"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 wrote:[color=blue]
> On 15 Mar 2006 21:56:08 -0800, in comp.lang.c , "sonu"
> <sanjaykumar.ba rick@gmail.com> wrote:
>
>[color=green]
>>Hi i want to find the greater number without any operator.[/color]
>
>
> I may have it.
>
> #include <stdio.h>
> int main(void)
> {
> char x[12], y[12];
> printf("please enter two numbers, the larger first\n");[/color]
This uses the () operator to call printf (the parens
are described as a "postfix operator" in 6.5.2).
"Ravi Nakidi" <laviravi@gmail .com> wrote:
[color=blue]
> This is the one solution[/color]
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.
[color=blue]
> #include<stdio. h>
>
> main()
> {
>
> printf("Enter two numbers:");
>
> scanf("%d"%d",& a,&b);[/color]
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.
[color=blue]
> if(a/b){
> if(b/a)
> printf("Both are equal");
> else
> printf("%d is big",a);
> }
> else
> printf("%d is big",b);[/color]
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?
[color=blue]
> }
>
> I think this is the solution u are expecting.[/color]
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.
Ravi Nakidi wrote:[color=blue]
> Hi Sonu,[/color]
Please quote context.
[color=blue]
> This is the one solution
>
>
>[/color]
Trim excess linefeeds before posting.
[color=blue]
> #include<stdio. h>
> main()[/color]
Correct forms of main() are either 'int main(void)' or 'int main(int
argc, char **argv)'.
[color=blue]
> {
> printf("Enter two numbers:");[/color]
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.
[color=blue]
> scanf("%d"%d",& a,&b);[/color]
You haven't declared 'a' and 'b'. Your format string is also wrong. You
might want "%d %d" assuming a and b are integers.
[color=blue]
>
> if(a/b){
> if(b/a)
> printf("Both are equal");[/color]
"Ravi Nakidi" <laviravi@gmail .com> writes:[color=blue]
> 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.[/color]
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" <laviravi@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.
--
Keith Thompson (The_Other_Keit h) kst-u@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.
Comment