|
Is 1 prime?
Is 0 prime?
Is -1 prime?
What happens with IsPrime(int.MaxValue) ?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
The main purpose of the messages posted here is not directly giving solution or the project. It was just an idea and improvements are up to user. And if the solutions that suggested are at the level of a user, then it can be helpfull.
For your mathematical questions :
1 is not a prime number.
0 is not a prime number.
-1 is not a prime number.
For your logical questions:
ulong can be used too. But i dont think that this is not necesarry for a user that can not search google.
For information with corrections the metod should be like this.
public bool IsPrime(ulong number)
{
if (number < 2)
{
return false;
}
for (ulong i = 2; i < number; i++)
{
if (number % i == 0)
{
return false;
}
}
return true;
}
|
|
|
|
|
please, i want 2 write this program without using "bool" just a simple program, if, else, for..
the program should read an integer and display all prime numbers between it and 10.000
thank you
|
|
|
|
|
vidhish wrote: i want to write prime numbers program in c# 2.0
That's nice. It will be a good exercise for you, to warm up those programming skills. Start with something simple/slow that will work, like testing division for every lower number. Then try improve it, then turn to Google for more ideas.
Good luck.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008) ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Feel free to write the program. For future reference, you don't have to come here for permission to write code.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
A noble ambition. Good luck with it.
|
|
|
|
|
vidhish wrote: hi all,
i want to write prime numbers program in c# 2.0
OK, now that you have talked the talk, it's time now for you to code the codes.
|
|
|
|
|
darkelv wrote: code the codes
of course, you meant to say "code teh codez"
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi.....
can anybody tell me that how can i save my all application's work. mean that how can i save the images,circles,rectangle,lines or etl together..
if somebody knows it then plz explain me with some code...
i konw that image can be save via one of the Bitmap's method
i.e:
imageObj.Save(fileName);
but i want to save not only images , whole it(e.g: circles,rectangles,lines which a user is drawn on it) not a just an image.
plz dont send the source of anyother site because i m new commer .
if some body can explain this then do in it plz.
thx.........
--------------------------------------------------------------------------------
maifs
|
|
|
|
|
You don't want links, but you should maybe do some
research into Serialization[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi All,
In my application, i am automating the office word application. I need to retrieve the original setting of the input word document. How can i retrieve the header type from the document? Like header types are-
wdHeaderFooterPrimary
wdHeaderFooterEvenPages
wdHeaderFooterFirstPage
How to know that which setting is applied in the input document through code?
Viram Pandey
|
|
|
|
|
hi all,
I want export the pdf file.and I am using following code.In my system .But an error is displaying like adobe readercould not open 'down.pdf' because it is either not a supported file type or because the file has been damaged...
DataSet Ds = FillGrid2(sessionvalue, cid, cmid, crid, pid, sdate, edate);
Response.Clear();
Response.AppendHeader("Content-Type", "application/pdf");
Response.AppendHeader("Content-disposition", "attachment; filename=Download.pdf");
string str = "<table style='border:1px solid #000000;'>";
str += "<tr>";
str += "<td colspan='5'>" + "<b>Client: </b>" + client + "</td>";
str += "</tr>";
str += "<tr>";
str += "<td colspan='5'>" + "<b>Campaign: </b>" + campaign + "</td>";
str += "</tr>";
str += "<tr>";
str += "<td colspan='5'>" + "<b>Report Summary</b>" + "</td>";
str += "</tr>";
str += "<tr>";
str += "<td>" + "Type" + "</td>";
str += "<td>" + "Impression" + "</td>";
str += "<td>" + "Clicks" + "</td>";
str += "<td>" + "Start Date" + "</td>";
str += "<td>" + "End Date" + "</td>";
str += "</tr>";
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
{
str += "<tr style='border:1px solid #000000;'>";
for (int j = 0; j < Ds.Tables[0].Columns.Count; j++)
{
str += "<td>" + Ds.Tables[0].Rows[i][j].ToString() + "</td>";
}
str += "</tr>";
}
str += "</table>";
Response.Write(str);
If anybody knows please reply me..
thanks...
Raaj
|
|
|
|
|
I doing this project that i have no idea in my mind at all. U guy out whoever pls help me..Thax alot.. get back to me asap Thax alot=)
The router n parents are all button. Once the sever click at the router, it will than show it deter how many parent it have or link and when the sever click at the parent is will show how many children the parent link to or have and it detail of it also like temperature, terminal ID and other. The symbol for the children is a circle. We need to connection them with arrow shown. It just like a family tree from router link to parent and from parent it show how many children it have. We need to use Visual studio 2005 and C# to create own button n image. This project is like a piece of empty sheet of paper/form and our duty is to draw family tree on it.
|
|
|
|
|
Hi,
This seems to be a 2D drawing related project, therefore, the best thing I could suggest you to is to use Drawing classes of .Net framework.
Please take a look at the following article which shows how to drawing classes of .Net framework.
ARTICLE[^]
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
A double-post (accidental, me thinks) does not require a double-answer
|
|
|
|
|
I doing this project that i have no idea in my mind at all. U guy out whoever pls help me..Thax alot.. get back to me asap Thax alot=)
The router n parents are all button. Once the sever click at the router, it will than show it deter how many parent it have or link and when the sever click at the parent is will show how many children the parent link to or have and it detail of it also like temperature, terminal ID and other. The symbol for the children is a circle. We need to connection them with arrow shown. It just like a family tree from router link to parent and from parent it show how many children it have. We need to use Visual studio 2005 and C# to create own button n image. This project is like a piece of empty sheet of paper/form and our duty is to draw family tree on it.
|
|
|
|
|
Hi,
This seems to be a 2D drawing project. The best thing I can suggest you to go throuhg the Drawing Classes of .Net framework (i.e, their methods, properties etc.) which can help you to draw the drawing ojects on the canvas.
Take a look at the following article, this might help you in understaing the capabilities of drawing classes of .Net.
ARTICLE1[^]
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Requirement:
How I can get all the applications registered in windows os includes with Administative Tools
using through "RegistryKey" or any other way
if have any please let me know
Thanks
Kiran.
|
|
|
|
|
|
Requirement:
Getting all the installed exe's in windows os and as well as Administrative tools also
if any idea please let me know
Thanks.
Kiran
|
|
|
|
|
Hi i am writing a C# class library which i want to use in my VB Client
So i wrote class like this
[Guid("0AA209CD-D713-4336-8804-F7D4888F58BD")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
[ComVisible(true)]
public interface IClass1
{
void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr )] String[] IDs,int size);
}
[Guid("CCDAD140-DD55-4047-A925-A1B539396A01")]
[ComVisible(true)]
[ProgId("CommonCatalogue.Class1")]
public class Class1:IClass1
{
public void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[] IDs, int size)
{
string TempDate = "dfdf";
}
}
but when i referenced this library (.tlb) in VB the temp method singnature coming as
Temp1(IDs As String, size As Long)
i am unable to fix this. Please can any one help me in figuring out this.
|
|
|
|
|
|
Thanks for the response.
Ya using ref in the method's declaration of C# we can get the correct syntax in VB but is there any other way which does not require any ref in the method declaration.
|
|
|
|
|
Hello!
My name is Alla. I'w working as a programmer in New Hampshire. I've just started doing Word and Powerpoint Automation (never done before Office Automation). The application I'm working on now creates document-packages,containing one or more Word documents and export these documents to particular locations.
I created Word Application Instance only once at the beginning, so I use this Instance for all documents that I'm going to create for exporting. Everything was fine so far, but when I'm trying to export a huge amount of documents,the following error appears - RPC SERVER UNAVAILABLE and any reference to existing Word Instance throws an error ( it happens when during processing some documents for some reason Range.Paste method throws an exception (RPC server failed)., then I get MS Word warning message and Word trying to recover documents. Immediately after that I get RPC SERVER UNAVAILABLE - means that any access to my Word Instance fails. May be it makes sense to create many Word Application Instances for each document, but we have problem with performance.I tried to send this question to microsoft forums, but nobody responded..Could you, please, help me to solve this problem?
Thank you very much in advance and best regards.
Alla
|
|
|
|
|
Hi,
I'm not very knowledgeable on threading...
I'm using Invoke to receive Serial Port data. The form locks when I try and call "this.Close()". Do I have to remove/stop the Invoke thread before using "this.Close()" to automatically close the form?
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
serialPortData = serialPort1.ReadExisting();
this.Invoke(new EventHandler(SerialPortEvent));
}
thanks,
Ron
|
|
|
|