Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.1K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Can somebody help me on building up my LOOP structure?

Posted 11 years ago
POSTED BY: Louis Piche
5 Replies
Posted 11 years ago

IF ANYBODY CAN HELP ME ON. THANKS.

Sir David Reiss, I have to thank you very much for your response. It works as required.

Catch@Do[If[IntegerQ[14291/i], Throw[{i, 14291/i}]], {i, 2, 14291}]

But now, as you specified, It would be better to insert a BREAK as soon as the loop encounters a suitable factor and Print the results. But, when I say PRINT, I would like to be able to Print the results from my printer machine too not only Print on the Wolfram screen.

There is something more I would be pleased. I would like to see and print on the screen and on my printing machine the results of all divisions made into the loop keeping a certain number of decimals after the point (maybe 5 decimals when it is the case). As sample, 14291/2 = 7145.5; 14291/3=4763.66666.

CAN YOU HELP ME ON THOSE TWO QUESTIONS?

And, by the way, do you know a reference book when I could find out Wolfram programming language practice exercices of all kink?

Waiting for your reply, Thanks so much for your help, ___________________

POSTED BY: Louis Piche
POSTED BY: David Reiss

You need a right bracket to close the If statement.

Do[If[IntegerQ[107/i], Print[107/i]], {i, 1, 8}]

107

POSTED BY: Frank Kampas
Posted 11 years ago

Sir,

Thanks. You are right. I forgot a bracket for the If.

Can you help me on the following (I got this from David Reiss which was a very good response)? I would like to insert a BREAK as soon as a first factor is found out, print on the screen and also print the result from my printing machine.

Catch@Do[If[IntegerQ[14291/i], Throw[{i, 14291/i}]], {i, 2, 14291}]

ALSO, From a new command line, to get all the results of the divisions along with decimals (maximum of 5 decimals) and print on the screen and from my printing machine.

Thanks for your reply, Have a good day

POSTED BY: Louis Piche
Posted 8 years ago
POSTED BY: Louis Piche
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard