Learn C ProgrammingLearn ProgrammingPrograms On FunctionsResources

062. Write a program to calculate square and cube of a given number in C language

By September 18, 2012 September 5th, 2018 No Comments

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

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

int qube(int x)
{
	return(x*x*x);
}
main()
{
	int n;
	clrscr();
	printf("Enter number.....");
	scanf("%d",&n);
	printf("\nSquare : %d\n",square(n));
	printf("\nQube   : %d\n",qube(n));
	qube(n);
	getch();
}


Leave a Reply

DEMO01