c programming tutorial
April 29, 2019

## C Program to Calculate square of a number using functions

## C Program to Calculate square of a number using functions

This program to calculate square in c allows the user to enter an integer value and then finds the square of that number using Functions.

Calculate_Square (int Number) function will calculate the square and return the value.

## CODE

#include<stdio.h>

int square(int); // function prototype declaration.

void main()

{

int number, answer;

printf("Enter your number:");

scanf("%d", &number);

answer = square(number); //Call function.

printf("Square of %d is %d.", number, answer);

}

int square(int n)

{

//function logic is written here..

return(n*n); //This will return answer to main function.

}