fork download
#include <stdio.h>
#include <math.h>  // Include math.h for sqrt() function

int main() {
    double num, square, cube, squareRoot;

    // Input the number from the user
    printf("Enter a number: ");
    scanf("%lf", &num);

    // Calculate square, cube, and square root
    square = num * num;
    cube = num * num * num;
    squareRoot = sqrt(num);  // Using sqrt() from math.h to calculate the square root

    // Output the results
    printf("Square of %.2f is: %.2f\n", num, square);
    printf("Cube of %.2f is: %.2f\n", num, cube);
    printf("Square root of %.2f is: %.2f\n", num, squareRoot);

    return 0;
}
Success #stdin #stdout 0.01s 5288KB
stdin
25
stdout
Enter a number: Square of 25.00 is: 625.00
Cube of 25.00 is: 15625.00
Square root of 25.00 is: 5.00