## Making an area calculator full project

We will make an area calculator full project here using C language. In this full project, we will give you the source code in C for area calculator and you can use them for taking idea about a project or use them in any purpose. Let’s see the source code bellow.

## Area calculator full project source code

Let’s get started to write code for making an area calculator full project by C.

``````// area calculator full project by C language

#include <stdio.h>
int main(){
int selectedShape;

int i = 1;
while(i >= 1){

printf("\n******* What do you want to calculate? *******\n\n");
printf("\t1. Area of triangle.\n");
printf("\t2. Area of square.\n");
printf("\t3. Area of rectangle.\n");
printf("\t4. Area of circle.\n");
printf("\t5. Area of parallelogram.\n");
printf("\t6. Area of rhombus.\n");

printf("\n\nEnter the code of shape you want to calculate : ");
scanf("%d", &selectedShape);

if(selectedShape == 1){
printf("\n\n\t\tYou want to calculate area of triangle\n\n\n");

float height, base, area;
printf("\t\tEnter the height of triangle : ");
scanf("%f", &height);
printf("\n\t\tEnter the base of triangle : ");
scanf("%f", &base);
area = 1.0/2 * base * height;
printf("\n\n\t\tArea is = %.2f square unit.\n", area);

int decision;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &decision);

if (decision == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}
}else if(selectedShape == 2){
printf("\n\n\t\tYou want to calculate area of square.\n\n\n");
float arm, areaOfSquare;
printf("\t\tEnter the length of a arm : ");
scanf("%f", &arm);
areaOfSquare = arm * arm * 1.0;
printf("\n\n\t\tArea is = %.2f square unit.\n", areaOfSquare);

int secondDecision;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &secondDecision);

if (secondDecision == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}
}else if(selectedShape == 3){
printf("\n\n\t\tYou want to calculate area of rectangle.\n\n\n");
float height3, width3, area3;
printf("\t\tEnter the height of rectangle : ");
scanf("%f", &height3);
printf("\n\t\tEnter the width of rectangle : ");
scanf("%f", &width3);
area3 = height3 * width3 * 1.0;
printf("\n\n\t\tArea is = %.2f square unit.\n", area3);

int decision3;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &decision3);

if (decision3 == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}

}else if(selectedShape == 4){
printf("\n\n\t\tYou want to calculate area of circle.\n\n\n");
printf("\t\tEnter the radius of circle : ");
area4 = 22.0/7 * radius * radius;
printf("\n\n\t\tArea is = %.2f square unit.\n", area4);

int decision4;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &decision4);

if (decision4 == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}

}else if(selectedShape == 5){
printf("\n\n\t\tYou want to calculate area of parallelogram.\n\n\n");
float base5, height5, area5;
printf("\t\tEnter the height of parallelogram : ");
scanf("%f", &height5);
printf("\n\t\tEnter the base of parallelogram : ");
scanf("%f", &base5);
area5 = height5 * base5 * 1.0;
printf("\n\n\t\tArea is = %.2f square unit.\n", area5);

int decision5;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &decision5);

if (decision5 == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}

}else if(selectedShape == 6){
printf("\n\n\t\tYou want to calculate area of rhombus.\n\n\n");
float dia1, dia2, area6;
printf("\t\tEnter the length of first diagonal : ");
scanf("%f", &dia1);
printf("\n\t\tEnter the length of second diagonal : ");
scanf("%f", &dia2);
area6 = 1/2.0 * dia1 * dia2;
printf("\n\n\t\tArea is = %.2f square unit.\n", area6);

int decision6;
printf("\n\n\t\tDo you want to calculate more?\n");

printf("\n\t\t\t1. YES");
printf("\n\t\t\t2. NO");
printf("\n\n\t\tPress 1 for YES, 2 for NO : ");
scanf("%d", &decision6);

if (decision6 == 2){
printf("\n\n\t\tThank You! Bye!\n\n");
i = 0;
}else{
i++;
}

}

}
return 0;
}``````

Give the input that which area you want to calculate. You need not give the shape name. You have to give only the shape code as mentioned above when you will run this program. You should perform other things as directed.

### Output of this area calculator full project :

``````******* What do you want to calculate? *******

1. Area of triangle.
2. Area of square.
3. Area of rectangle.
4. Area of circle.
5. Area of parallelogram.
6. Area of rhombus.

Enter the code of shape you want to calculate : 5

You want to calculate area of parallelogram.

Enter the height of parallelogram : 4

Enter the base of parallelogram : 6

Area is = 24.00 square unit.

Do you want to calculate more?

1. YES
2. NO

Press 1 for YES, 2 for NO : 2

Thank You! Bye!

Process returned 0 (0x0)   execution time : 42.056 s
Press any key to continue.
( here you enter 4 for calculate the area of circle)``````

But if you press 2 at the end when it says “Do you want to calculate more?”, then you will redirected to main option again. Let’s see the output here.

``````******* What do you want to calculate? *******

1. Area of triangle.
2. Area of square.
3. Area of rectangle.
4. Area of circle.
5. Area of parallelogram.
6. Area of rhombus.

Enter the code of shape you want to calculate : 3

You want to calculate area of rectangle.

Enter the height of rectangle : 5

Enter the width of rectangle : 7

Area is = 35.00 square unit.

Do you want to calculate more?

1. YES
2. NO

Press 1 for YES, 2 for NO : 1

******* What do you want to calculate? *******

1. Area of triangle.
2. Area of square.
3. Area of rectangle.
4. Area of circle.
5. Area of parallelogram.
6. Area of rhombus.

Enter the code of shape you want to calculate :``````

You can add more option to make the calculator more effective. So, try yourself to make changes and make it according to your choice. Best of luck!

Previous pageFull projects by C

Next pageStop watch full by C