Programming Excercise
Programming Excercise
class Main {
if ( num % i == 0)
isPrime = false;
break;
}
}
if ( isPrime == true )
System.out.println(num);
class Main {
double a = Integer.parseInt(sc.nextLine());
double b = Integer.parseInt(sc.nextLine());
double c = Integer.parseInt(sc.nextLine());
if(a!=0.0){
double d = (b*b)-(4*a*c);
if (d==0.0){
double r = -b/(2*a);
}else if(d>0.0){
double r1 = (-b+(Math.sqrt(d)))/(2*a);
double r2 = (-b-(Math.sqrt(d)))/(2*a);
}else{
double rp = -b/(2*a);
double ip = Math.sqrt(-d)/(2*a);
}else{
System.out.println("Not a quadratic equation.");
class Main {
int sum=0;
for(int n=0;n<num;n++){
int x = Integer.parseInt(sc.nextLine());
numbers[n] = x;
}
for(int i = 0; i < numbers.length; i++) {
class Main {
int flag = 0;
int x = Integer.parseInt(sc.nextLine());
for(int i=0;i<numbers.length;i++){
if (x==numbers[i]){
flag = 1;
break;
if(flag==0){
class Main {
int x = number%2;
if(x==0){
else{
Output:
class Main {
public static void main(String[] args) {
int c =Integer.parseInt(sc.nextLine());
float f = ((9*c)/5)+32;
Output:
class Main {
int a= sc.nextInt();
int b= sc.nextInt();
int c= sc.nextInt();
double s=(a+b+c)/2.0;
double area=Math.sqrt(s*(s-a)*(s-b)*(s-c));
else
}
}
Output:
class Main {
int i = 0;
float sum = 0;
for(i=0;i<count;i++){
int x = Integer.parseInt(sc.nextLine());
sum = sum + x;
}
https://pythonistaplanet.com/java-programming-exercises-with-solutions/