Click here to Skip to main content
15,913,758 members
Home / Discussions / C#
   

C#

 
GeneralRe: Transferring image from webservice to PPC Pin
John Arlen122-May-05 14:56
John Arlen122-May-05 14:56 
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 
Sounds like homework to me Sigh | :sigh:

Ill give you some help but unless you have a special problem you will have to implement it yourself.

1. To find all prime numbers between 1 and 100 you will have to make a loop and check every number if its a prime number (ok if you are clever you only test the unequal numbers).
2. To check if a number is prime you will have make another loop checking if the number to test can be divided by another number which is bigger than 1 and smaller than itself (again if you are clever you only test up to n/2).
3. To test if a number can be deivided by another one use the mod (%) operator. If a % b == 0 then the numbers can be divided.
4. Every successfully tested number could stored in an ArrayList.
5. After youve tested all numbers just loop through the list and caculate the average.

Just as a note to the perfectionists: I know there are better algorithms for that but for such small numbers that will do it perfectly well.
GeneralRe: C# code to find Prime Numbers Pin
Asad Hussain21-May-05 10:43
Asad Hussain21-May-05 10:43 
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 

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.