SHARE
TWEET

Untitled

PiDPC Oct 15th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. /*
  5. Daniel Wasiak
  6. Wzór Herona - Zadanie
  7. */
  8. int main() {
  9.  
  10.     float a, b, c;
  11.  
  12.     printf("Podaj liczbe A: ");
  13.     scanf("%f", &a);
  14.     printf("Podaj liczbe B: ");
  15.     scanf("%f", &b);
  16.     printf("Podaj liczbe C: ");
  17.     scanf("%f", &c);
  18.  
  19.     if(a+b>c && a+c>b && b+c>a) {
  20.         //Mozna stworzyc trojkat z tych bokow
  21.         float p = (a+b+c)/2, surface;
  22.         surface = sqrt( p*(p-a)*(p-b)*(p-c) );
  23.         printf("\nPole powierzchni podanego trojkata to: \n%f jednostek\n", surface);
  24.  
  25.     } else {
  26.         //Taki trokjat nie istnieje
  27.         printf("\nZ podanych bokow nie mozna zbudowac trojkata.\n");
  28.     }
  29.  
  30.     printf("\n");
  31.  
  32.     return 0;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top