Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

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

YASH PAL, 31 July 202429 January 2026

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
c coding problems solutions cPrograms

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes