Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 3. How Big Is Your Slice?
- Me and my roommate have been fighting for over an hour about who has the bigger pizza slice. He thinks that mine is bigger, but I think he's just saying that so he can't give up his slice, which is obviously bigger!
- However, since we are educated gentlemen, we have decided to let math decide for us. I'm going to give you two measurements: base and height. Using these two measurements, determine the area of our triangular pizza slices and end this feud once and for all!
- Note: Area of a triangle = (base x height) / 2
- Inputs
- 1. The base of the pizza slize
- 2. The height of the pizza slice
- */
- #include <stdio.h>
- int main (void){
- float base, height, area;
- printf("Enter the base of the pizza slice: ");
- scanf("%f", &base);
- printf("Enter the height of the pizza slice: ");
- scanf("%f", &height);
- area = (base * height) / 2;
- printf("Area of the pizza slice = %.2f", area);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement