473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

re online c expression to print 1-100 numbers

write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve
You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);
}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...

Xavier
Jul 10 '07 #1
8 1794
Xavier Serrand wrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve

You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);
}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...
What exactly do you do with t? What will be the value of n upon first
entering prn100 - 1 or 100? And there's no termination condition for
the recursive calls.

Jul 10 '07 #2

"santosh" <sa*********@gmail.coma écrit dans le message de
news:11**********************@e9g2000prf.googlegro ups.com...
Xavier Serrand wrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve
You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);
}

With my poor english i don't exaclty know what "program solve" means ...
if
it is required the program stop well ... my way is not a correct one ...

What exactly do you do with t? What will be the value of n upon first
entering prn100 - 1 or 100? And there's no termination condition for
the recursive calls.


void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);
}
void main (int argc, char ** argv)
{
prn100(1);
}

when reaching 100 ... there will be a divid by zero fault... ending the
program (a crash issue)... ok it's horrible ...

xavier
Jul 10 '07 #3
On Jul 10, 5:56 pm, "Xavier Serrand" <xxxxxx.xxxx...@xxx.frwrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve

You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);

}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...

Xavier
i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression

Jul 11 '07 #4
bobby wrote:
On Jul 10, 5:56 pm, "Xavier Serrand" <xxxxxx.xxxx...@xxx.frwrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve
You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);

}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...

i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression
If this is an exercise given to you as part of a course, I suggest you
discontinue it immediately. I also suggest that you take some time to
improve your English. I'm not saying this to be insulting. Your post
hardly makes sense.

Jul 11 '07 #5
santosh <sa*********@gmail.comwrites:
bobby wrote:
>On Jul 10, 5:56 pm, "Xavier Serrand" <xxxxxx.xxxx...@xxx.frwrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve

You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);

}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...

i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression

If this is an exercise given to you as part of a course, I suggest you
discontinue it immediately.
What? And he will magically pass his course because "Santosh from c.l.c
told me not to bother doing it". I'm sure as he sits, jobless, in years
to come he will thank you for making him realise his tutor is not top
flight. But meanwhile back in the real world .....

Jul 11 '07 #6
On Wed, 11 Jul 2007 04:38:14 +0000, bobby wrote:
On Jul 10, 5:56 pm, "Xavier Serrand" <xxxxxx.xxxx...@xxx.frwrote:
write a online c expression to print 1 -100 numbers with out using
control statements/structures, jumps-conditional/unconditional.given
the program dont modify and solve

You can do it with recursion and ... stop when exception ... glups ...

void prn100(int n)
{
double t;
printf("%i\n", n);
t = 1 / (100 - n);
prn100(n+1);

}

With my poor english i don't exaclty know what "program solve" means ... if
it is required the program stop well ... my way is not a correct one ...

Xavier

i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression
Yes, a function call is an expression. And there is no way to
produce output without calling any function.

--
Army1987 (Replace "NOSPAM" with "email")
"Never attribute to malice that which can be adequately explained
by stupidity." -- R. J. Hanlon (?)

Jul 11 '07 #7
Richard wrote:
santosh <sa*********@gmail.comwrites:
bobby wrote:
<snip>
i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression
If this is an exercise given to you as part of a course, I suggest you
discontinue it immediately.

What? And he will magically pass his course because "Santosh from c.l.c
told me not to bother doing it". I'm sure as he sits, jobless, in years
to come he will thank you for making him realise his tutor is not top
flight. But meanwhile back in the real world .....
I didn't tell him to sit jobless. The exercise is terrible and is
likely an indicator of the overall quality of the course. I'm sure the
OP can enroll with better courses. Even a self-taught approach with a
good book like K&R2 is likely to be better.

Jul 11 '07 #8
santosh <sa*********@gmail.comwrites:
Richard wrote:
>santosh <sa*********@gmail.comwrites:
bobby wrote:

<snip>
>i wiil explain clear
given problem is
int 1=1;
int main()
{
/*your expresssion here*/
printf("%d",i);
return 0;
}
this is tha actuall code with modifying this u have to write a online
expression that gives output 1 -100 num that too with out using
control structures,control statements,conditional jumps
altough way of solving problem is wright but i want a online
expression,fun calling is not a epression

If this is an exercise given to you as part of a course, I suggest you
discontinue it immediately.

What? And he will magically pass his course because "Santosh from c.l.c
told me not to bother doing it". I'm sure as he sits, jobless, in years
to come he will thank you for making him realise his tutor is not top
flight. But meanwhile back in the real world .....

I didn't tell him to sit jobless. The exercise is terrible and is
likely an indicator of the overall quality of the course. I'm sure the
OP can enroll with better courses. Even a self-taught approach with a
good book like K&R2 is likely to be better.
Look, for goodness sake, at the VERY most you should advise him to
*possibly* mention the weakness of the example with his tutor. He might
even get extra points if the tutor is open minded enough to realise his
error. What you advise is ridiculous - he will end up getting kicked off
his course. Bad examples can and do happen. And since he is not a C
programmer yet, I somehow feel he is not equipped to select a better
course. And, unfortunately, in the real world, "self taught from K&R2"
doesn't hold much sway in that first vetting of CVs in newbie grad land.
Jul 11 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
1
by: David Faden | last post by:
Hi, Given arbitrary Python source code input by the user, I want to get the result of executing that source as an expression if it is an expression and otherwise execute the source as a...
0
by: Steven Bethard | last post by:
So I was looking at the Python 3.0 wiki (http://www.python.org/moin/Python3_2e0) and noticed that one of the major changes would be that builtin classes and functions would take and return...
3
by: snacktime | last post by:
The primary question is how do I perform a match when the regular expression contains string variables? For example, in the following code I want to match a line that starts with STX, then has any...
43
by: Roger L. Cauvin | last post by:
Say I have some string that begins with an arbitrary sequence of characters and then alternates repeating the letters 'a' and 'b' any number of times, e.g. "xyz123aaabbaabbbbababbbbaaabb" I'm...
19
by: Davy | last post by:
Hi all, I am a C/C++/Perl user and want to switch to Python (I found Python is more similar to C). Does Python support robust regular expression like Perl? And Python and Perl's File...
5
by: Avi Kak | last post by:
Folks, Does regular expression processing in Python allow for executable code to be embedded inside a regular expression? For example, in Perl the following two statements $regex =...
5
by: Gigs_ | last post by:
Can someone explain me bitwise expression? few examples for every expression will be nice x << y Left shift x >y Right shift x & y Bitwise AND x | y Bitwise OR x ^ y Bitwise XOR (exclusive...
20
by: TimeHorse | last post by:
I would like to gauge interest in the following proposal: Problem: Assignment statements cannot be used as expressions. Performing a list of mutually exclusive checks that require data...
19
by: kawaks40 | last post by:
Hi everyone :) I just recently started using access/sql. and right away I ran into this problem "SQL expression too complex" I google'd a lot on what it means, and the only workaround I've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.