Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline amit28it  
#1 Posted : 06 January 2012 01:06:30(UTC)
amit28it


Rank: Member

Groups: Registered
Joined: 18/10/2011(UTC)
Posts: 16
Location: Jaipur

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?

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline TheWizEd  
#2 Posted : 08 January 2012 05:47:18(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
Not sure what your looking for but here is a simple routine to find prime numbers between 1 and 100.

Open in SMath Cloud

Does anyone know how to do if without else?

Edited by user 08 January 2012 05:48:49(UTC)  | Reason: Not specified

Ed
Offline omorr  
#3 Posted : 08 January 2012 23:40:23(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
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:
Open in SMath Cloud
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.
Open in SMath Cloud

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

Edited by user 09 January 2012 00:04:41(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.