Function Programming : Area of Circle in C

Write a program to find the area of a Circle. Use function to find area where area = pi * r ^ 2( r means radius, ^ means power and the value of pi is 3.144) .

Source Code in C:

#include<stdio.h>
float checkArea(float radius)
{
      float area;
      area=3.14159*(radius*radius) ;
      return area;
}
int main()
{
      float r, area_of_circle=0;
      printf ("\nEnter Radius: ");
      scanf ("%f", &r);
      area_of_circle=checkArea(r);
      printf ("\nArea is: %f", area_of_circle);
}

38 comments:

  1. #include
    #include

    int check_area(radius);
    int main()
    {
    int n,shohan;
    printf("\n Enter radius:");
    scanf("%d",&n);
    shohan=check_area(n);
    printf("\n Area is %d",shohan);
    getch();
    return 0;

    }
    int check_area(int radius)
    {
    int r;
    r=3.14159*radius*radius;
    getch();
    return r;

    }

    ReplyDelete
  2. #include
    #include
    float check_area(float);
    main()
    {
    float n,result;
    printf("\n Enter radius\n:");
    scanf("%f",&n);
    result=check_area(n);
    printf("\n Area is %f",result);
    getch();
    return 0;
    }
    float check_area(float radius)
    {
    float r;
    r=3.14159*radius*radius;
    getch();
    return r;

    }

    ReplyDelete
  3. #include
    #define PI 3.1416
    float area_of_rectangle(float length,float width)
    {
    float result;
    result=(length*width);
    return (result);
    }
    main()
    {
    float length,width;
    printf(" \nEnter the value of length : ");
    scanf("%d",&length);
    printf(" \nEnter the value of width : ");
    scanf("%d",&width);
    printf("%d",area_of_rectangle(length,width));
    return 0;
    }

    ReplyDelete
  4. #include

    float checkArea(float radius)
    {
    float r;
    r=3.14159*radius*radius;
    return r;
    }

    void main()
    {
    float n,result;
    printf("Enter radius:");
    scanf("%f",&n);
    result=checkArea(n);
    printf("\nArea is %f",result);
    }

    ReplyDelete
  5. #include
    using namespace std;
    float areaa()
    {
    int r;
    cout<<"enter the value of r"<>r;
    return (float)3.1416*r*r;
    }
    main()
    {

    int a;
    float area=0;
    area=areaa();
    cout<<"the areaa is:"<<area<<endl;
    }

    ReplyDelete
  6. #include
    using namespace std;
    float area_of_rectangle(float length,float width)
    {
    float result;
    result=(length*width);
    return(result);
    }
    main()
    {
    float length,width;
    cout<<"enter the value of length:"<>length;
    cout<<"enter the value of width:"<>width;
    cout<<"area_of_rectangle(length,width)"<<endl;
    return 0;
    }

    ReplyDelete
  7. Id-201210803

    #include
    #define pi 3.1416
    using namespace std;
    float ar(float x)
    {
    return pi*x*x;
    }
    int main()
    {
    float r,area=0;
    cout<<"enter the value of radious";
    cin>>r;
    area=ar(r);
    cout<<"the area is"<<area;
    }

    ReplyDelete
  8. #include
    using namespace std;

    class area_of_circle
    {
    public:
    int radious;
    area_of_circle();
    ~area_of_circle();
    void show();
    };

    area_of_circle::area_of_circle()
    {
    cout<<"Enter a value as the radius of the circle: ";
    cin>>radious;
    }
    void area_of_circle::show()
    {
    double area=3.1416*radious*radious;
    cout<<endl<<"Area is: "<<area<<endl;
    }
    area_of_circle::~area_of_circle()
    {
    cout<<endl<<"DESTRUCTING"<<endl;
    }
    main()
    {
    area_of_circle ob1,ob2;
    ob1.show();
    ob2.show();
    }

    ReplyDelete
  9. #include
    using namespace std;
    class area
    {
    public:
    int rad;
    area();
    ~area();
    void output();
    };
    area::area()
    {
    cout<<"Enter the radious: ";
    cin>>rad;
    cout<<endl;
    }
    void area::output()
    {
    float result=3.1416*rad*rad;
    cout<<"AREA: "<<result<<endl;
    }
    area::~area()
    {
    cout<<endl;
    }
    int main()
    {
    area obj;
    obj.output();
    return 0;
    }

    ReplyDelete
  10. #include
    using namespace std;

    class cons
    {
    public:
    int radius;
    cons(int rad);
    ~cons();

    double area();
    };

    cons::cons(int rad)
    {
    radius = rad;
    }

    double cons::area()
    {
    float pi = 3.1416;
    double result;
    result = pi * (radius*radius);
    return result;
    }

    cons::~cons()
    {
    cout << "[+]MEMORY RELEASED[+]\n";
    }

    int main()
    {
    int i;
    cout << "Enter your circle radius --: ";
    cin >> i;
    cons obj(i);
    cout << "The area of the circle -- " << obj.area() << "\n";
    return 0;
    }
    id- 201510505
    batch 48

    ReplyDelete
  11. #include
    using namespace std;
    class area
    {
    public:
    int rad;
    area();
    ~area();
    void result();
    };
    area::area()
    {
    cout<<"Enter the radius:";
    cin>>rad;
    cout<<endl;
    }
    void area::result()
    {
    float result=3.1416*rad*rad;
    cout<<"Area:"<<result<<endl;
    }
    area::~area()
    {

    }
    int main()
    {
    area ob;
    ob.result();
    return 0;
    }

    ID 201510280
    48TH

    ReplyDelete
  12. #include
    using namespace std;
    class circle
    {
    public:
    circle(int r);
    ~circle()
    {

    }

    };
    circle::circle(int r)
    {
    cout<<3.1416*r*r;

    }
    int main()
    {
    int r;
    cout<<"Input Radious of circle: ";
    cin>>r;
    circle appel(r);
    }

    ReplyDelete
  13. using C++

    #include
    using namespace std;

    class cons
    {
    public:
    int radius;
    cons(int rad);
    ~cons();

    double area();
    };

    cons::cons(int rad)
    {
    radius = rad;
    }

    double cons::area()
    {
    float pi = 3.1416;
    double result;
    result = pi * (radius*radius);
    return result;
    }

    cons::~cons()
    {
    cout << "[+]MEMORY RELEASED[+]\n";
    }

    int main()
    {
    int i;
    cout << "Enter your circle radius --: ";
    cin >> i;
    cons obj(i);
    cout << "The area of the circle -- " << obj.area() << "\n";
    return 0;
    }

    ReplyDelete
  14. using c++
    area of circle by constructor
    mamun ur rashid

    #include
    using namespace std;
    class circle
    {
    public:
    float a,radius;
    circle();

    ~circle();
    void result();
    };
    circle::circle()
    {
    cout<<"Enter a number :" ;
    cin>>radius;
    }
    circle::~circle()
    {

    }
    void circle::result()
    {
    a=3.14155*(radius*radius);

    cout<<a;
    }
    int main()
    {
    circle sb;
    sb.result();
    }

    ReplyDelete
  15. #include
    using namespace std;
    class circle
    {
    public:
    float area,radius;
    circle();
    ~circle();
    void result();
    };
    circle::circle()
    {
    cout<<"Enter the value :" <>radius;
    }
    circle::~circle()
    {

    }
    void circle::result()
    {
    area=3.1416*(radius*radius);

    cout<<area;
    }
    int main()
    {
    circle sb;
    sb.result();
    }

    ReplyDelete
  16. #include
    using namespace std;
    class area
    {
    public:
    double radius,result;
    area();
    ~area()
    {
    cout<<"Distructor active";
    }
    double func()
    {
    result=(3.1416*radius*radius);
    cout<<"The area of the circle: "<>radius;
    }

    int main()
    {
    area obj;
    obj.func();
    return 0;
    }

    id:201510660

    ReplyDelete
  17. #include
    using namespace std;

    class Divisible
    {
    public:
    int num;
    Divisible();

    ~Divisible()
    {
    cout<<"Distructor active";
    }
    int func()
    {
    if(num%5==0)
    cout<<"The number is divisible"<>num;
    }

    int main()
    {
    Divisible obj;
    obj.func();
    return 0;
    }


    id:201510660

    ReplyDelete
  18. #include
    using namespace std;
    class area
    {
    public:
    double radius,result;
    area();
    ~area()
    {
    cout<<"Distructor active";
    }
    double setu()
    {
    result=(3.1416*radius*radius);
    cout<<"The area of the circle: "<>radius;
    }

    int main()
    {
    area obj;
    obj.setu();
    return 0;
    }

    id:201510992

    ReplyDelete
  19. using c++

    #include
    using namespace std;

    class cons
    {
    public:
    int radius;
    cons(int rad);
    ~cons();

    double area();
    };

    cons::cons(int rad)
    {
    radius = rad;
    }

    double cons::area()
    {
    float pi = 3.1416;
    double result;
    result = pi * (radius*radius);
    return result;
    }

    cons::~cons()
    {
    cout << "[+]MEMORY RELEASED[+]\n";
    }

    int main()
    {
    int i;
    cout << "Enter your circle radius --: ";
    cin >> i;
    cons obj(i);
    cout << "The area of the circle -- " << obj.area() << "\n";
    return 0;
    }

    ReplyDelete
  20. ID : 201620195
    https://www.dropbox.com/s/95b9tmlr9rd712b/01.cpp?dl=0

    ReplyDelete
  21. ID:201520552
    1)https://drive.google.com/open?id=0B5pG0kIjzgEKenJyOXh2Skw0ekU
    2)https://drive.google.com/open?id=0B5pG0kIjzgEKNGc0ckV3aUl0QjQ

    ReplyDelete
  22. ID:201520552
    2)https://drive.google.com/open?id=0B5pG0kIjzgEKbS1aUzdUZHdxckE

    ReplyDelete
  23. MD USUF MIA
    ID 201610456
    link:
    https://drive.google.com/open?id=0B_PIGnOMR0K2YTl4cUx2c0hieTg

    ReplyDelete
  24. Summer 2017
    ID#201610042

    https://drive.google.com/file/d/0B99eePh0LV8gYXI2THVETFZ0VGs/view?usp=drivesdk

    ReplyDelete
  25. https://drive.google.com/open?id=0B3bVD5Ppt_STTWk0MnJMMWxzbTA

    ReplyDelete
  26. Name:Abdullah
    ID:201710933
    https://drive.google.com/open?id=0B0bbxKUPFizZMVhHTDN3bEZMQzg

    ReplyDelete
  27. https://drive.google.com/open?id=0Byxq3aat_mNSc2RiRk1OSTB4UlE

    ReplyDelete
  28. https://drive.google.com/open?id=0BzKpnVbF4fc3MWEyTGlnZE5sSjg

    ReplyDelete
  29. ID:201710494
    https://www.dropbox.com/s/ogym0isdqji31d0/Hw2%281%29.cpp?dl=0

    ReplyDelete
  30. https://drive.google.com/open?id=0BxajN_bZJJw0ak1GbXJzTDdCdkk

    ReplyDelete
  31. https://drive.google.com/open?id=0B5eevQy6QwSOb19sMHZLSmxFSzg

    ReplyDelete
  32. ID:-201610058
    1.https://drive.google.com/open?id=0B7UQyRdu6h2waHhWS1hKanZOajA

    ReplyDelete
  33. https://drive.google.com/open?id=0B_PIGnOMR0K2a2ZaSzhOcHNXTGc

    ReplyDelete
  34. https://drive.google.com/open?id=0B_PIGnOMR0K2a2ZaSzhOcHNXTGc

    ReplyDelete
  35. https://drive.google.com/open?id=1n60AGZdyXW_ETTtGrY2jdnn8ds_d2IMZFUcywYDwFnU

    ReplyDelete
  36. P.S. ID #201610288, Section A, Summer 2017

    ReplyDelete
  37. #include
    using namespace std;

    class area
    {
    public:
    float a=0,r;
    area()
    {
    cout<<"Enter radius:";
    cin>>r;
    }
    void in()
    {
    a=3.14159*(r*r);
    cout<<"Area:"<<a;
    }
    };
    int main()
    {
    area obj;
    obj.in();
    return 0;
    }

    ReplyDelete