Skip to content

Instantly share code, notes, and snippets.

@northofnormal
Created February 26, 2018 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save northofnormal/9e628b24d178e1051e7c1c93c0eb6383 to your computer and use it in GitHub Desktop.
Save northofnormal/9e628b24d178e1051e7c1c93c0eb6383 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main (void) {
float d;
float half, square, cube;
printf("Enter a number between 1 and 100: \n");
scanf("%f", &d);
half = d/2;
square = d*d;
cube = d*d*d;
printf("\nYour number is %.2f\n", d);
printf("\nHalf of that is %.2f\n", half);
printf("\nSquare it to get %.2f\n", square);
printf("\nCube it to get %.2f\n", cube);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment