Function with Parameters and Return Value

#include <stdio.h>

// Function to calculate the square of a number
int square(int num) {
    return num * num;
}

int main() {
    // Function with parameters and return value
    int number = 4;
    int result = square(number);
    printf("Square of %d: %d\n", number, result);

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website