Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
GeneralRe: Transferring image from webservice to PPC Pin
Yeast2722-May-05 19:56
Yeast2722-May-05 19:56 
Questioncheckbox ? Pin
youssef21-May-05 5:04
youssef21-May-05 5:04 
AnswerRe: checkbox ? Pin
zhengdong jin21-May-05 6:04
zhengdong jin21-May-05 6:04 
GeneralMenustrip Selfmade Pin
Anonymous21-May-05 4:45
Anonymous21-May-05 4:45 
GeneralRe: Menustrip Selfmade Pin
Robert Rohde21-May-05 5:00
Robert Rohde21-May-05 5:00 
GeneralC# code to find Prime Numbers Pin
diabolusgorgon21-May-05 4:33
diabolusgorgon21-May-05 4:33 
GeneralRe: C# code to find Prime Numbers Pin
Robert Rohde21-May-05 4:46
Robert Rohde21-May-05 4:46 
GeneralRe: C# code to find Prime Numbers Pin
Asad Hussain21-May-05 10:43
Asad Hussain21-May-05 10:43 
HOMEWORK!!!!!

Here is the *simplest* algorithm

i - Loop through all odd numbers. That eliminates all even numbers which by definition CANNOT be prime.
ii - Write a function that loops thru from 3 - sqrt(number) and if the mod results in 0 at any point then that number is not a prime. No need to test dividing by 1 and 2 since every number can be divided by 1 and you have eliminated even numbers so no need to divide by 2. You could go up to n/2 but it is unnecessary. eg. you are testing 47 for prime:
* sqrt(47) = 7 (roughly)
* if any number from 3-7 cannot divide 47 then it is surely a prime so u tested 5 numbers instead of 24.
iii - Store every successfully tested number in some sort of collection.
iv - Iterate thru the collection and do the average


GeneralRe: C# code to find Prime Numbers Pin
diabolusgorgon21-May-05 13:31
diabolusgorgon21-May-05 13:31 
GeneralRe: C# code to find Prime Numbers Pin
Robert Rohde21-May-05 20:04
Robert Rohde21-May-05 20:04 
GeneralRe: C# code to find Prime Numbers Pin
diabolusgorgon21-May-05 13:27
diabolusgorgon21-May-05 13:27 
GeneralRe: C# code to find Prime Numbers Pin
Robert Rohde21-May-05 20:37
Robert Rohde21-May-05 20:37 
QuestionHow to include HTML Pin
Murtuza Husain Miyan Patel21-May-05 4:13
professionalMurtuza Husain Miyan Patel21-May-05 4:13 
AnswerRe: How to include HTML Pin
DavidNohejl21-May-05 4:22
DavidNohejl21-May-05 4:22 
Generalobfuscator/urgent!!! Pin
rabi kumar21-May-05 1:39
rabi kumar21-May-05 1:39 
GeneralListbox Context Menu Pin
Da`Sooty20-May-05 23:06
Da`Sooty20-May-05 23:06 
GeneralRe: Listbox Context Menu Pin
S. Senthil Kumar21-May-05 0:16
S. Senthil Kumar21-May-05 0:16 
GeneralRe: Listbox Context Menu Pin
Robert Rohde21-May-05 0:26
Robert Rohde21-May-05 0:26 
GeneralProblem reading stream Pin
AnonymousTwo20-May-05 22:50
AnonymousTwo20-May-05 22:50 
GeneralRe: Problem reading stream Pin
Robert Rohde21-May-05 0:48
Robert Rohde21-May-05 0:48 
Generaljoin DBF files Pin
Bedevian20-May-05 20:07
Bedevian20-May-05 20:07 
GeneralRe: join DBF files Pin
Robert Rohde20-May-05 20:56
Robert Rohde20-May-05 20:56 
GeneralRe: join DBF files Pin
Bedevian20-May-05 23:56
Bedevian20-May-05 23:56 
GeneralRe: join DBF files Pin
Robert Rohde21-May-05 0:15
Robert Rohde21-May-05 0:15 
GeneralRe: join DBF files Pin
Bedevian21-May-05 19:34
Bedevian21-May-05 19:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.