All pastes #22291 Raw Edit

Anonymous

public text v1 · immutable
#22291 ·published 2005-09-07 09:48 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

float LOG2 (float x) {
  return(log10(x)/log10(2.0));
}

main () {

  float x;

  printf("Please enter a float: ");
  scanf("%f", &x);
  printf("The base two logarithm of %f is %f\n", x, LOG2(x));

  printf("Please enter a real number: ");
  scanf("%f", &x);
  printf("The base two logarithm of %f is %f\n", x, LOG2(x));

  printf("Please enter a real number: ");
  scanf("%f", &x);
  printf("The base two logarithm of %f is %f\n", x, LOG2(x));

}