Computer Science, asked by arkamukherjee324, 4 months ago

write this program in java

Attachments:

Answers

Answered by wwwalison8888a
0

import java.util.Scanner;

class quadratic

{

static void find_roots()

{

Scanner obj= new Scanner(System.in);

System.out.println("Enter value of a");

int a=obj.nextInt();

System.out.println("Enter value of b");

int b=obj.nextInt();

System.out.println("Enter value of c");

int c=obj.nextInt();

int D= Math.pow(b,2)-(4*a*c);

if(D>0)

System.out.println("Roots are real");

else

if(D==0)

System.out.println("Roots are real and equal");

else

System.out.println("Roots are complex and different");

}

}

//don't forget to write the variable description

// hope it helps, have a good day:)

Answered by yashvisrp5425a
0

import java.util.*;

class replace

{public static void main()

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter value of a, b and c respectively ");

       int a=sc.nextInt();

       int b=sc.nextInt();

       int c=sc.nextInt();

       int disc;

       disc=(b*b)-(4*a*c);

       if (disc==0)

       {

           System.out.println("roots are real and equal");

       }

       else if (disc>0)

       {

           System.out.println("roots are real and unequal");

       }

       else if  (disc<0)

       {

           System.out.println("roots are complex and different");

       }

   }

}

Similar questions