Program to cheque roots are real,imaginary or equal in C-language

Program to cheque roots are real,imaginary or equal in C-language

#include<stdio.h>
int main()
{
    int a,b,c;
    printf("Enter the coefficient of x^2\n");
    scanf("%d",&a);
    printf("Enter the coefficient of x\n");
    scanf("%d",&b);
    printf("Enter the constant term\n");
    scanf("%d",&c);
    if(((b*b)-(4*a*c))==0)
    {
            printf("Roots are real and equal");
    }
  else  if(((b*b)-(4*a*c))>0)
        {
        printf("Roots are real and distinct");
            }
    else
      {
        printf("Roots are imaginary");
    }
}

OUTPUT
Enter the coefficient of x^2
1
Enter the coefficient of x
2
Enter the constant term
4
Roots are imaginary

Visit Homepage

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language