To compute the root of a number using function in C


Levels of difficulty: / perform operation:

C program to compute the root of a number using function.

C Program

#include <stdio.h>
#include <conio.h>
unsigned long root(int);
void main()
{
	int x;
	unsigned long res;
	clrscr();
	printf("\nENTER A NUMBER: ");
	scanf("%d",&x);
	res=root(x);
	printf("\nROOT OF %d IS = %lu",x,res);
	getch();
}
unsigned long root(int a)
{
	unsigned long b;
	b=a*a;
	return(b);
}


Output