Guest User

Untitled

a guest
Apr 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. /* pointer love */
  6. double entropy (double *p) {
  7. double v = *p;
  8. return (log(v)/v*log(v));
  9. }
  10.  
  11. int main() {
  12. double *i = (double*) malloc(sizeof(double));
  13. scanf("%d", i);
  14. printf("%d\n",entropy(i));
  15. }
Add Comment
Please, Sign In to add comment