Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- /*
- Daniel Wasiak
- Wzór Herona - Zadanie
- */
- int main() {
- float a, b, c;
- printf("Podaj liczbe A: ");
- scanf("%f", &a);
- printf("Podaj liczbe B: ");
- scanf("%f", &b);
- printf("Podaj liczbe C: ");
- scanf("%f", &c);
- if(a+b>c && a+c>b && b+c>a) {
- //Mozna stworzyc trojkat z tych bokow
- float p = (a+b+c)/2, surface;
- surface = sqrt( p*(p-a)*(p-b)*(p-c) );
- printf("\nPole powierzchni podanego trojkata to: \n%f jednostek\n", surface);
- } else {
- //Taki trokjat nie istnieje
- printf("\nZ podanych bokow nie mozna zbudowac trojkata.\n");
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement