Wednesday, July 1, 2015

Square of a number by function


#include<stdio.h>

int square(int);

int main(){
    
int a;

printf("Please enter a number:");
scanf("%d",&a);

printf("\nThe square of %d is:%d\n",a,square(a));

return 0;
}
int square(int x){

int y;
y=x*x;

return y;

}

No comments:

Post a Comment