PROGRAM TO CALCULATE THE EXTENSIVE OF PLANE WITH THE C PROGRAMMING LANGUAGE

in #utopian-io6 years ago (edited)

What Will I Learn?

We will learn about how to create a program to calculate the extensive of plane using C programming language

  • Formulas to Calculate the extensive of triangle
  • Formulas to Calculate the extensive of Square

Requirements

Dev C++ 5.11

Difficulty

  • Intermediate

Tutorial Contents

This program created to help the user, to calculate the Extensive kind of plane. Some plane was entering to the program is triangle, square, rectangle, parallelogram, Kite, Rombus and Circle.

For The first case is Triangle, the triangle has some of the type that is the same distance, the equilateral triangle, and irregular triangle, the formula used to calculate the triangle Extensive is is ½ x Base x height.

For the Second case is square. A square is a plane with four mutually connected sides that has a size on the same side. To calculate the Extensive of a square used the formula Side x side.

The next case is a rectangle, a rectangle is a plane that has long sided with the same size and width of the sides also of equal size. So the formula used to calculate the plane of a rectangle is length x width.

Code for the program :

 
int main(void){
int Option, Opt;
float Base, Hight, Lenght, Wide, Side, d1, d2, r, Extensive;
Start:
printf("^^^^A SIMPLE PROGRAM TO CALCULATE THE EXTENSIVE OF PLANE^^^^\n");
printf("************ MENU ************\n");
printf("1. Triangle \n");
printf("2. Square \n");
printf("3. Rectangle \n");
printf("4. Parallelogram \n");
printf("5. Kite \n");
printf("6. Rhombus \n");
printf("7. Circle \n");
printf("8. Exit \n");
printf("^^^^^^Created By Baixiian ^^^^^^^\n\n");
printf("Select Your option : ");
scanf("%d", &Option);
switch (Option)
{
case 1 :
printf("\n");
printf("^^^ Calculate The Extensive Of Triangle^^^ \n");
printf("Input base value: ");
scanf("%f", &Base);
printf("Input Hight value :");
scanf("%f", &Hight);
Extensive =( (0.5 * Base) * Hight);
printf("The Extensive of Triangle = %.3f \n", Extensive);
printf("=============================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 2 :
printf("\n");
printf("==== Calculate The Extensive Of Square==== \n");
printf("Input side value : ");
scanf("%f", &Side );
Extensive = Side * Side;
printf("The Extensive of Square : %.3f \n", Extensive);
printf("============================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 3 :
printf("\n");
printf("**** Calculate The Extensive Of Rectangle **** \n");
printf("Input Lenght Value : ");
scanf("%f", &Lenght);
printf("Input wide value V: ");
scanf("%f", &Wide);
Extensive = Lenght * Wide;
printf("The Extensive Of Rectangle : %.3f \n", Extensive);
printf("====================================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 4:
printf("\n");
printf("==== Calculate The Extensive Of Parallelogram ==== \n");
printf("Input base value : ");
scanf("%f", &Base);
printf("Input hight value : ");
scanf("%f", &Hight);
Extensive = Base * Hight;
printf("The Extensive Of Parallelogram : %.3f \n", Extensive);
printf("====================================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 5:
printf("\n");
printf("^^^ Calculate The Extensive Of Kite ^^^ \n");
printf("Input diagonal1 value : ");
scanf("%f", &d1);
printf("Input diagonal2 value : ");
scanf("%f", &d2);
Extensive = d1 * d2 * 0.5;
printf("The Extensive Of Kit : %.3f \n", Extensive);
printf("====================================== \n");
printf("1. Back to Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 6:
printf("\n");
printf("^^^^ Calculate The Extensive of Rombus ^^^^ \n");
printf("Input diagonal1 value : ");
scanf("%f", &d1);
printf("Input diagonal2 value ");
scanf("%f", &d2);
Extensive = d1 * d2 * 0.5;
printf("The Extensive of Rombus : %.3f \n", Extensive);
printf("====================================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 7:
printf("\n");
printf("==== Calculate The Value Of Circle ===== \n");
printf("Input the ribs value of circle : ");
scanf("%f", &r);
Extensive = 3.14 * r * r;
printf("The Value Of Circle : %.3f \n", Extensive);
printf("================================== \n");
printf("1. Back To Home \n");
printf("2. Exit \n");
printf("Option :");
scanf("%d", &Opt);
if(Opt == 1)
goto Start;
else
exit;
return(0);
break;
case 8:
exit;
break; 
default:
printf("Sorry, You Must Enter The Appropriate Menu Option \n");
goto Start;
break;
}
}
 


01.jpg

02.jpg

03.jpg

04.jpg

05.jpg

06.jpg

Result work:

The following is an example of the results of the program with the value already entered into the programs . First of all the program will prompt to enter the value of the base and than the program also will ask for a high value, then press enter and answers from the Extensive of any triangle will show. after show the result of triangle it's will followed with the chioce menu for the user. if he want to e xit just input 2 in the question, or 1 to back to main menu or home.

01.jpg

in home or main menu square are nomered with number 2. The followingbelow is an example of the results of square extensive calculation program, with the value was entered into the program. When the user has selected the No. 2 which is a square then the next program will ask the user to enter a value of side. After pressing enter then the answer to square extensive will show. Same as before after the answer showing then will followed with the next option if the user wants to go back to the main menu by typing the number 1 or close the program by typing the number 2 on the option.

02.jpg

In the main menu of the rectangle are in third place.

03.jpg

Above is the result of the calculation of the Extensive of the rectangle. After the user selects number 3 on the main menu, then the title for the calculation of plane will showing. The next user will be prompted to enter the value of the length and width side of the rectangle. After pressing enter then the answer from the area of a rectangle will be out. Then will follow the option to return to the main menu and exit from the program. For the next user can do it like was explained earlier.

04.jpg

05.jpg

06.jpg

07.jpg

08.jpg



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @baixiian I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

This post has been hidden in Utopian since you linked it with a wrong repository. General tutorial for C language cannot be linked with RPC framework.

Be sure with your future contributions that the selected repository really is for the project you want to teach about.

You can contact us on Discord.
[utopian-moderator]