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 / chandra kiran

answer for 3rd question
static void Main(string[] args)
{
Console.Write("Please Enter the radius of the circle : ");
int r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please Enter the center of the circle ");
Console.Write("Please Enter x coordinate of the centre : ");
int x1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please Enter y coordinate of the centre : ");
int y1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please Enter the Point ");
Console.Write("Please Enter x coordinate of the point : ");
int x2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please Enter y coordinate of the point : ");
int y2 = Convert.ToInt32(Console.ReadLine());
int check =Convert.ToInt32(Math.Sqrt(Math.Pow(x2-x1,2)+Math.Pow(y2-y1,2)));
if (check < r)
Console.WriteLine("Inside the Circle");
else if (check == r)
Console.WriteLine("On the Circle");
else
Console.WriteLine("Outside the Circle");
}
//don't enter centre of the circle and point (1,2) ,(5,6) like this enter each coordinate individually

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the base class from which all value types are derived?

503


What are custom exceptions in C#?

557


What is a method signature c#?

521


Does c# support try-catch-finally blocks?

480


Can I use ReaderWriterLock instead of Monitor.Enter/Exit for Threading?

520






Why is static constructor called first?

482


What is default method in c#?

503


Is friend a constructor?

514


What is the use of 0 in c#?

505


What will be the output of the following code?

514


What does public mean in c#?

521


What is fcl in c#?

492


What is the default value of datetime in c#?

496


Difference between call by value and call by reference in C#?

525


What is serialization in unity?

507