C Program to find the square of a number using a function

In this tutorial, we are going to write a C Program to find the square of a number using a function in C Programming with practical program code and step-by-step full complete explanation.

C Program to find the square of a number using a function

C Program to find the square of a number using a function

 
#include<stdio.h>
#include<conio.h>

void main()
{
	int rev(int);
	int r,a;

	clrscr();

	printf("Enter any number: ");
	scanf("%d",&a);

	r = rev(a);

	printf("Square is: %d",r);

	getch();
}

int rev(int x)
{
	return(x*x);
}

Output

 
Enter any number: 5
Square is: 25