1.write a program in C# to find a given point which is
inside in a circle. Given circle's radius and its center
point?
2.Write a program in C# to generated 20 prime numbers
greater than a given number? (It should be more efficient
for large numbers also)
3. Write a Code to check whether a given point is inside a
circle or not? given Circle's raduis and its center point.
4. using oops concept, design an elevator do not forget
buttons on each floor..

Answer Posted / ganesh

take 4 textboxes , cx=centre x, cy=centre y, r=radius,
x=x co-oridnate, y=y co-ordinate.
double d;

calculate the distnace between centre and point taken
if distance less than radius(inside) else outside

simple


d = Math.Sqrt(Math.Pow((int.Parse(cx.Text) - int.Parse(x.Text)), 2) + Math.Pow((int.Parse(cy.Text) - int.Parse(y.Text)), 2));


if (d <Double.Parse( r.Text))
Label1.Text = "inside";
else
Label1.Text = "outside";

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is asenumerable in c#?

490


Define collections?

497


What are the Types of compatabilities and explain them

524


What is the difference between a private assembly and a shared assembly?

557


What is the purpose of reserved word using in c#?

501






Is comparator a functional interface?

465


What is data set in c#?

502


What is the purpose of the integer parse method the decimal parse method?

527


What is difference between mutable and immutable in c#?

455


How do I create a dbml file?

486


What is the default value of datetime in c#?

496


What is difference between dynamic and var in c#?

484


Are c and c# the same thing?

495


Explain “static” keyword in c#?

483


Describe an abstract class?

559