Author Topic: warnings  (Read 8462 times)

Offline narendrav

  • Single posting newcomer
  • *
  • Posts: 3
warnings
« on: May 18, 2011, 04:06:00 pm »
here is my code:-

#include<math.h>

 int main()
{

    float a,b,c,discriminant,root1,root2;
    printf("input values of a,b, and c\n");
    scanf("%f %f %f",&a,&b,&c);
    discriminant = b*b - 4*a*c;
    if (discriminant<0)
       printf("\n\nROOTS ARE IMAGINARY\n");
    else
     {
         root1=(-b+sqrt(discriminant))/(2.0*a);
         root2=(-b-sqrt(discriminant))/(2.0*a);
         printf("\n\nroot1=%5.2f\n\nroot2=%5.2f\n,root1,root2");

     }
     return 0;
}

it shows the following warnings.

warning: implicit declaration of function 'printf'|
warning: incompatible implicit declaration of built-in function 'printf'|
warning: implicit declaration of function 'scanf'|
warning: incompatible implicit declaration of built-in function 'scanf'|
warning: too few arguments for format|
||=== Build finished: 0 errors, 5 warnings ===|


though the program still runs i want to know what those warnings mean and i want to rectify them

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: warnings
« Reply #1 on: May 18, 2011, 04:56:53 pm »
We do not provide support for general programming questions here, and your question is just that (did you read the rules before posting?).

Google should be enough to find the answer.