Program to find square of a number using functions.
#include<stdio.h>
#include<conio.h>
void main()
{
int rev(int);
int r,a;
clrscr();
printf(“enter any no: ”);
scanf(“%d”,&a);
r=rev(a);
printf(“square is : %d”,r);
getch();
}
int rev(int x)
{
return(x*x);
}
Output:
enter any no: 5
square is : 25
#include<stdio.h>
#include<conio.h>
void main()
{
int rev(int);
int r,a;
clrscr();
printf(“enter any no: ”);
scanf(“%d”,&a);
r=rev(a);
printf(“square is : %d”,r);
getch();
}
int rev(int x)
{
return(x*x);
}
Output:
enter any no: 5
square is : 25
No comments:
Post a Comment