Math loop but solves when x is correct [closed]












-1












$begingroup$


Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by José Carlos Santos, Jyrki Lahtonen, DanielV, supinf, Lord Shark the Unknown Jan 18 at 5:09


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2




    $begingroup$
    Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
    $endgroup$
    – Yuriy S
    Jan 10 at 11:27










  • $begingroup$
    Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
    $endgroup$
    – Ingix
    Jan 10 at 11:34






  • 3




    $begingroup$
    loop-spaces is probably not the right category here either.
    $endgroup$
    – Paul
    Jan 10 at 11:35










  • $begingroup$
    @YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 11:41






  • 1




    $begingroup$
    Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
    $endgroup$
    – Yuriy S
    Jan 10 at 11:49
















-1












$begingroup$


Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by José Carlos Santos, Jyrki Lahtonen, DanielV, supinf, Lord Shark the Unknown Jan 18 at 5:09


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • 2




    $begingroup$
    Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
    $endgroup$
    – Yuriy S
    Jan 10 at 11:27










  • $begingroup$
    Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
    $endgroup$
    – Ingix
    Jan 10 at 11:34






  • 3




    $begingroup$
    loop-spaces is probably not the right category here either.
    $endgroup$
    – Paul
    Jan 10 at 11:35










  • $begingroup$
    @YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 11:41






  • 1




    $begingroup$
    Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
    $endgroup$
    – Yuriy S
    Jan 10 at 11:49














-1












-1








-1





$begingroup$


Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.










share|cite|improve this question











$endgroup$




Is there a calculation of some sort that loops itself when for example x =1 but stops looping and solves when x is for example 5.







loop-spaces






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 10 at 11:53







brian vandemeulebroucke

















asked Jan 10 at 11:26









brian vandemeulebrouckebrian vandemeulebroucke

12




12




closed as unclear what you're asking by José Carlos Santos, Jyrki Lahtonen, DanielV, supinf, Lord Shark the Unknown Jan 18 at 5:09


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by José Carlos Santos, Jyrki Lahtonen, DanielV, supinf, Lord Shark the Unknown Jan 18 at 5:09


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 2




    $begingroup$
    Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
    $endgroup$
    – Yuriy S
    Jan 10 at 11:27










  • $begingroup$
    Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
    $endgroup$
    – Ingix
    Jan 10 at 11:34






  • 3




    $begingroup$
    loop-spaces is probably not the right category here either.
    $endgroup$
    – Paul
    Jan 10 at 11:35










  • $begingroup$
    @YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 11:41






  • 1




    $begingroup$
    Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
    $endgroup$
    – Yuriy S
    Jan 10 at 11:49














  • 2




    $begingroup$
    Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
    $endgroup$
    – Yuriy S
    Jan 10 at 11:27










  • $begingroup$
    Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
    $endgroup$
    – Ingix
    Jan 10 at 11:34






  • 3




    $begingroup$
    loop-spaces is probably not the right category here either.
    $endgroup$
    – Paul
    Jan 10 at 11:35










  • $begingroup$
    @YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 11:41






  • 1




    $begingroup$
    Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
    $endgroup$
    – Yuriy S
    Jan 10 at 11:49








2




2




$begingroup$
Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
$endgroup$
– Yuriy S
Jan 10 at 11:27




$begingroup$
Please clarify the question (add some proper definitions, like what do you mean by trap?), and ideally, some wider context for this question
$endgroup$
– Yuriy S
Jan 10 at 11:27












$begingroup$
Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
$endgroup$
– Ingix
Jan 10 at 11:34




$begingroup$
Are thinking about something like this ($int{e^xsin(x)dx}$): youtube.com/watch?v=Acp8PFx8180
$endgroup$
– Ingix
Jan 10 at 11:34




3




3




$begingroup$
loop-spaces is probably not the right category here either.
$endgroup$
– Paul
Jan 10 at 11:35




$begingroup$
loop-spaces is probably not the right category here either.
$endgroup$
– Paul
Jan 10 at 11:35












$begingroup$
@YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
$endgroup$
– brian vandemeulebroucke
Jan 10 at 11:41




$begingroup$
@YuriyS What i mean with trap: a calculation that loops when solved wrong but solved itself when example : x is wrong the hole calculation starts again but when x is right it works out.
$endgroup$
– brian vandemeulebroucke
Jan 10 at 11:41




1




1




$begingroup$
Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
$endgroup$
– Yuriy S
Jan 10 at 11:49




$begingroup$
Still no idea what you mean, maybe it's just me though. What you absolutely should do is edit the post with additional explanation instead of adding several comments. There's an edit button for a reason
$endgroup$
– Yuriy S
Jan 10 at 11:49










1 Answer
1






active

oldest

votes


















0












$begingroup$

The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).



INPUT $x$



Label (A)



If $x=1$ GOTO (A)



If $x neq 1$ GOTO (B)



Label (B)



OUTPUT $3$



END






share|cite|improve this answer











$endgroup$













  • $begingroup$
    You did not just use two (!) goto directives in 7 lines of code :
    $endgroup$
    – Yuriy S
    Jan 10 at 12:00










  • $begingroup$
    Thanks! That is what i need!
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 12:01










  • $begingroup$
    @YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
    $endgroup$
    – coffeemath
    Jan 10 at 12:03






  • 1




    $begingroup$
    @coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
    $endgroup$
    – Yuriy S
    Jan 10 at 12:04


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).



INPUT $x$



Label (A)



If $x=1$ GOTO (A)



If $x neq 1$ GOTO (B)



Label (B)



OUTPUT $3$



END






share|cite|improve this answer











$endgroup$













  • $begingroup$
    You did not just use two (!) goto directives in 7 lines of code :
    $endgroup$
    – Yuriy S
    Jan 10 at 12:00










  • $begingroup$
    Thanks! That is what i need!
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 12:01










  • $begingroup$
    @YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
    $endgroup$
    – coffeemath
    Jan 10 at 12:03






  • 1




    $begingroup$
    @coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
    $endgroup$
    – Yuriy S
    Jan 10 at 12:04
















0












$begingroup$

The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).



INPUT $x$



Label (A)



If $x=1$ GOTO (A)



If $x neq 1$ GOTO (B)



Label (B)



OUTPUT $3$



END






share|cite|improve this answer











$endgroup$













  • $begingroup$
    You did not just use two (!) goto directives in 7 lines of code :
    $endgroup$
    – Yuriy S
    Jan 10 at 12:00










  • $begingroup$
    Thanks! That is what i need!
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 12:01










  • $begingroup$
    @YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
    $endgroup$
    – coffeemath
    Jan 10 at 12:03






  • 1




    $begingroup$
    @coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
    $endgroup$
    – Yuriy S
    Jan 10 at 12:04














0












0








0





$begingroup$

The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).



INPUT $x$



Label (A)



If $x=1$ GOTO (A)



If $x neq 1$ GOTO (B)



Label (B)



OUTPUT $3$



END






share|cite|improve this answer











$endgroup$



The following is more of a program (in pseudocode) than a "calculation", but it can trap itself (when $1$ is input) and can calculate $3$ (when something not $1$ is input, such as $5.$).



INPUT $x$



Label (A)



If $x=1$ GOTO (A)



If $x neq 1$ GOTO (B)



Label (B)



OUTPUT $3$



END







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Jan 10 at 12:00

























answered Jan 10 at 11:57









coffeemathcoffeemath

2,9171415




2,9171415












  • $begingroup$
    You did not just use two (!) goto directives in 7 lines of code :
    $endgroup$
    – Yuriy S
    Jan 10 at 12:00










  • $begingroup$
    Thanks! That is what i need!
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 12:01










  • $begingroup$
    @YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
    $endgroup$
    – coffeemath
    Jan 10 at 12:03






  • 1




    $begingroup$
    @coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
    $endgroup$
    – Yuriy S
    Jan 10 at 12:04


















  • $begingroup$
    You did not just use two (!) goto directives in 7 lines of code :
    $endgroup$
    – Yuriy S
    Jan 10 at 12:00










  • $begingroup$
    Thanks! That is what i need!
    $endgroup$
    – brian vandemeulebroucke
    Jan 10 at 12:01










  • $begingroup$
    @YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
    $endgroup$
    – coffeemath
    Jan 10 at 12:03






  • 1




    $begingroup$
    @coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
    $endgroup$
    – Yuriy S
    Jan 10 at 12:04
















$begingroup$
You did not just use two (!) goto directives in 7 lines of code :
$endgroup$
– Yuriy S
Jan 10 at 12:00




$begingroup$
You did not just use two (!) goto directives in 7 lines of code :
$endgroup$
– Yuriy S
Jan 10 at 12:00












$begingroup$
Thanks! That is what i need!
$endgroup$
– brian vandemeulebroucke
Jan 10 at 12:01




$begingroup$
Thanks! That is what i need!
$endgroup$
– brian vandemeulebroucke
Jan 10 at 12:01












$begingroup$
@YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
$endgroup$
– coffeemath
Jan 10 at 12:03




$begingroup$
@YuriyS Yes, that's sloppy. OP just wanted something so I'll leave it. Guess the second GOTO could be dropped, along with LABEL (B),
$endgroup$
– coffeemath
Jan 10 at 12:03




1




1




$begingroup$
@coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
$endgroup$
– Yuriy S
Jan 10 at 12:04




$begingroup$
@coffeemath, I'm just kidding, really I quite enjoyed your answer, cheers
$endgroup$
– Yuriy S
Jan 10 at 12:04



Popular posts from this blog

Bressuire

Cabo Verde

Gyllenstierna