Prime numbers

Prime numbers - Сообщения

#1 Опубликовано: 05.01.2012 18:06:30
amit28it

amit28it

0 сообщений из 16 понравились пользователям.

Группа: User

Like calculator can we check which are prime and which are not in list of prime numbers to 100 and use of these nummbers a/c to runtime .Can you tell us this ? What the cause behind that?
#2 Опубликовано: 07.01.2012 22:47:18
Edward Ulle

Edward Ulle

20 сообщений из 182 понравились пользователям.

Группа: Moderator

Not sure what your looking for but here is a simple routine to find prime numbers between 1 and 100.

[LIVE width=350 height= 800]http://smath.info/live/?file=3409[/LIVE]

Does anyone know how to do if without else?
Ed
#3 Опубликовано: 08.01.2012 16:40:23
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Ed,

If I understood you well, you are asking for "if" without "else" because you needed this structure in your example above. As far as know, there is only one "if" structure, function in SMath, - "if" with 3 arguments. We could just make "if" function with two arguments this way:
[LIVE width=267 height=423]http://smath.info/live/?file=3415[/LIVE]
and use it in our worksheets. The drawback of this one is that the "if" defined this way can not have a "line" structure as a second argument (not quite sure about that) although the second argument could be a function call.
[LIVE width=220 height=241]http://smath.info/live/?file=3418[/LIVE]

I am not sure, but I think that Andrey can not make two "if" operators in programming palette. It would be a problem to distinguish them. I am not sure again, but I hope there would be possible to put if(2) and if(3) in the function list and, therefore, having both "if" structures - with and without "else".

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений