frain8

Untitled

Nov 20th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. /* Dasprog C - 2019
  2. William Handi Wijaya
  3. 0087
  4.  
  5. Program untuk menghitung luas segitiga.
  6. */
  7.  
  8. #include <stdio.h>
  9.  
  10. int getInput();
  11. int keliling(int n);
  12. double luas(int n);
  13.  
  14. int main(void)
  15. {
  16.     // Masukkan input
  17.     int n = getInput();
  18.    
  19.     // Print luas;
  20.     printf("Luas: %lf\n", luas(n));
  21.     return 0;
  22. }
  23.  
  24. int getInput()
  25. {
  26.     int n;
  27.     scanf("%d", &n);
  28.     return n;
  29. }
  30.  
  31. double luas(int n)
  32. {
  33.     return (0.5 * (double) n * n);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment