### 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 area;
return area;
}
int main()
{
float r, area_of_circle=0;
scanf ("%f", &r);
area_of_circle=checkArea(r);
printf ("\nArea is: %f", area_of_circle);
}

1. This comment has been removed by the author.

2. #include
#include

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

}
{
int r;
getch();
return r;

}

3. #include
#include
float check_area(float);
main()
{
float n,result;
scanf("%f",&n);
result=check_area(n);
printf("\n Area is %f",result);
getch();
return 0;
}
{
float r;
getch();
return r;

}

4. #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;
}

5. #include

{
float r;
return r;
}

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

6. #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;
}

7. #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;
}

8. Id-201210803

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

9. #include
using namespace std;

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

area_of_circle::area_of_circle()
{
cout<<"Enter a value as the radius of the circle: ";
}
void area_of_circle::show()
{
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();
}

10. #include
using namespace std;
class area
{
public:
area();
~area();
void output();
};
area::area()
{
cout<<endl;
}
void area::output()
{
cout<<"AREA: "<<result<<endl;
}
area::~area()
{
cout<<endl;
}
int main()
{
area obj;
obj.output();
return 0;
}

11. #include
using namespace std;

class cons
{
public:
~cons();

double area();
};

{
}

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

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

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

12. #include
using namespace std;
class area
{
public:
area();
~area();
void result();
};
area::area()
{
cout<<endl;
}
void area::result()
{
cout<<"Area:"<<result<<endl;
}
area::~area()
{

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

ID 201510280
48TH

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

}

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

}
int main()
{
int r;
cin>>r;
circle appel(r);
}

14. using C++

#include
using namespace std;

class cons
{
public:
~cons();

double area();
};

{
}

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

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

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

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

#include
using namespace std;
class circle
{
public:
circle();

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

}
void circle::result()
{

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

16. #include
using namespace std;
class circle
{
public:
circle();
~circle();
void result();
};
circle::circle()
{
}
circle::~circle()
{

}
void circle::result()
{

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

17. #include
using namespace std;
class area
{
public:
area();
~area()
{
cout<<"Distructor active";
}
double func()
{
cout<<"The area of the circle: "<>radius;
}

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

id:201510660

18. #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

19. #include
using namespace std;
class area
{
public:
area();
~area()
{
cout<<"Distructor active";
}
double setu()
{
cout<<"The area of the circle: "<>radius;
}

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

id:201510992

20. using c++

#include
using namespace std;

class cons
{
public:
~cons();

double area();
};

{
}

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

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

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

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

22. ID:201520552

23. ID:201520552

24. MD USUF MIA
ID 201610456

25. Summer 2017
ID#201610042

27. Name:Abdullah
ID:201710933

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

33. ID:-201610058

37. P.S. ID #201610288, Section A, Summer 2017

38. #include
using namespace std;

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

39. ID:201610456
constructor with parameter
https://ideone.com/7stTgp

40. ID:201610456
https://ideone.com/QLHHf5