Computer Science, asked by tushar103, 1 year ago

write a program to input an angle and determine the quadrant in which the angle lies based on the following using C plus plus programming

Answers

Answered by Deadbeat
6
#include<studio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("Enter the measure of the angle "};
scanf("%d",&a);
if 0<=a<361
{
if a<=90
printf("It lies in first quadrant ");
else if 90<a<=180
printf("It lies in second quadrant");
else if 180<a<=270
printf("It lies in third quadrant");
else
printf("It lies in fourth quadrant");
}
else
printf("Invalid measure ");
getch ();
}
Answered by harnathyadav2907
2

\huge\mathbb\pink{\underline {\underline{Answer}}}

import java.util.Scanner;

public class FiftyPrimes

{

// Return true if a number n is prime

public static boolean isPrime(long n)

{

// Check division from 2 to sqrt(n)

for (long i = 2; i <= Math.sqrt(n); i++)

{

if (n % i == 0)

{

return false;

}

}

// If no division is found, number is prime

return true;

}

public static void main(String[] args)

{

// Create Scanner object

Scanner sc = new Scanner(System.in);

// Take user input

System.out.print("Enter the starting point: ");

long start = sc.nextInt();

// Close Scanner object

sc.close();

// If start point is less than 2, make it 2

if (start < 2)

{

start = 2;

}

int numberOfPrimes = 0; // Number of primes printed

long number = start; // Number to be tested for prime

// Iterate until 50 primes are printed

while (numberOfPrimes < 50)

{

if (isPrime(number))

{

System.out.println(number);

numberOfPrimes++;

}

number++;

}

}

}

\huge\mathtt\purple{THANK\:YOU}

Similar questions