Your First Function
Completed
Complete int square(int x). The starter reads a number and prints square(n).
Input
One integer.
Output
Its square.
Example
Input
7
Output
49
Editor
C
Hints
The type before the name is what the function returns.
Solution explanation
A function takes inputs (parameters) and gives back one value with return.
Show solution
#include <stdio.h>
int square(int x) {
return x * x;
}
int main() {
int n;
scanf("%d", &n);
printf("%d\n", square(n));
return 0;
}