Skip to main content

Simple c program for find roots of polynomial (basic coding).

This program is for find roots of polynomial in which X has maximum power is 2 and coefficient of X^2 is not equal to zero.
#include<stdio.h>
#include<math.h>

void main()
{
     float a,b,c,d,e,f;
     printf("enter the  coefficient of X^2:");
     scanf("%f",&a);
     printf("enter the  coefficient of X:");
     scanf("%f",&b);
     printf("enter the value of  constant:");
     scanf("%f",&c);
     d=(b*b)-(4*a*c);
     if(d>=0&&a!=0)
        {
                 e=(-b+sqrt(d))/(2*a);
                 f=(-b-sqrt(d))/(2*a);
            printf ("Root 1 =%f",e);
            printf ("Root 2 =%f",f);
         }
      if(d<0&&a!=0)
         {
           e=-b/(2*a);
            f=sqrt(-d)/(2*a);
           printf ("Root 1=%f+%fi",e,f);
           printf ("Root 1=%f-%fi",e,f);
          }

}

For your choice program please tell me in comment box. 

Popular posts from this blog

Top ten Most Expensive Diamonds in the World for ever in history

Diamonds last forever, diamonds are a girl’s best friend, a diamond in the rough: these sayings all emphasise the beauty and strength of world’s most famous gems. Take a look at the 10 most expensive diamonds in the world in this Catawiki story! 10. The orange - 32 million euros This 14.82-carat bright orange diamond broke a world record when it sold for 32 million euros in 2013. Generally, pink and blue diamonds are the most sought after, but this rare gem surprised the world with its orange beauty and size. 9. The Princie - 33 million euros This pink, 34.54- carat diamond has been known of for 300 years now, after it was discovered in the Golconda mines in India. It was bought from the Hyderabad Royal family in 1960 by jewellers Van Cleef & Arpels, who named it the Princie after the son of Sita Devi, the Maharanee of Baroda, an extravagant and famous socialite living in Paris. 8. Graff Vivid Pink – 38,7 million euros A rectangular 24.78-carat diamond, classi...

TOP LAPTOP BRANDS IN THE WORLD

When going to purchase a laptop, individuals consider different specifications to suit their needs. Finding the desired laptop can seem a daunting task since there are numerous brands in the market. Due to technological advancement, many laptop manufacturers have emerged and if not careful, you may end up a victim of unscrupulous dealers. This article will highlight the top 10 best laptop brands of 2013. All brands are designed in different ways to take care of consumer need. Style, functionality, fashion and size are some of the factors that manufacturers consider when developing laptops. A potential laptop buyer needs to conduct thorough research prior to settling for any deal. Below is a compiled list of top laptop brands that can be helpful to any laptop buyer. 10 MSI Laptop Brand Sets the bar for all Haswell gaming laptops Micro-Star International is one of the best and least popular laptop brands. This company has been in existence since 1986 and is a renowned IT manu...

What is a transformer? All things about transformer

One of the main reasons that we use alternating AC voltages and currents in our homes and workplace’s is that AC supplies can be easily generated at a convenient voltage, transformed (hence the name transformer) into much higher voltages and then distributed around the country using a national grid of pylons and cables over very long distances. The reason for transforming the voltage to a much higher level is that higher distribution voltages implies lower currents for the same power and therefore lower I 2 *R losses along the networked grid of cables. These higher AC transmission voltages and currents can then be reduced to a much lower, safer and usable voltage level where it can be used to supply electrical equipment in our homes and workplaces, and all this is possible thanks to the basic  Voltage Transformer . A Typical Voltage Transformer The  Voltage Transformer  can be thought of as an electrical component rather than an electronic component. A tra...