Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!

# povrsina_trougla

By: nex036ara on Sep 25th, 2011  |  syntax: C  |  size: 0.73 KB  |  views: 549  |  expires: Never
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
1. /*program za izracunavanje povrsine trougla u ravni ako su zadate kordinate temena, potrebne podatke
2. citati sa glavnog ulaza racunara, a rezultat prikazati na glavnom izlazu*/
3.
4. #include <stdio.h>
5. int main()
6. {
7.     double xA,yA, xB,yB, xC,yC;
8.     double s,a,b,c,P;
9.
10.     printf("Unesi kordinate prvog temena:");
11.     scanf("%lf%lf", &xA, &yA);
12.     printf("Unesi kordinate drugog temena:");
13.     scanf("%lf%lf", &xB, &yB);
14.     printf("Unesi kordinate treceg temena:");
15.     scanf("%lf%lf", &xC, &yC);
16.     a = sqrt (pow(xA-xB, 2)+ pow(yA-yB, 2));
17.     b = sqrt (pow(xB-xC, 2)+ pow(yB-yC, 2));
18.     c = sqrt (pow(xC-xA, 2)+ pow(yC-yA, 2));
19.     s = (a+b+c)/2;
20.     printf("Povrsina trougla je %2.lf.", P = sqrt(s*(s-a)*(s-b)*(s-c)) );
21.
22. }
clone this paste RAW Paste Data
Top