News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

warnings

Started by narendrav, May 18, 2011, 04:06:00 PM

Previous topic - Next topic

narendrav

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

Ceniza

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.