What's wrong with it? Here's my code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Luvian
    New Member
    • Dec 2019
    • 1

    What's wrong with it? Here's my code

    Code:
    #include<stdio.h>
    #define PI 3.14;
    int main(void)
    {
        float r,h,C1,Sa,Sb,Va,Vb;
        scanf("%.2f%.2f",&r,&h);
        C1=(float)2*PI*r;
        Sa=(float)PI*r*r;
        Sb=(float)4*PI*r*r;
        Va=(float)(4/3)*PI*r*r*r;
        Vb=(float)PI*r*r*h;
        printf("C1=%.2f\n
                Sa=%.2f\n
                Sb=%.2f\n
                Va=%.2f\n
                Vb=%.2f",
                C1,Sa,Sb,Va,Vb);
    }
    errer:invalid type argument of unary'*' (have float)
    I'm so confused about it...
    Last edited by gits; Jan 2 '20, 08:08 AM. Reason: added code tags
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    Code:
    #define PI 3.14;
    PI is replaced by the value 3.14; and not by 3.14

    Comment

    Working...