fork download
  1. #include <stdio.h>
  2.  
  3. int square(int x);
  4.  
  5. int main(int argc, const char * argv[])
  6. {
  7. printf("Enter a number");
  8. int userNum;
  9. scanf("%d", &userNum);
  10. int result = square(userNum);
  11. printf("\nThe result is %d", result);
  12. return 0;
  13. }
  14.  
  15. int square(int x){
  16. int result = x*x;
  17. return result;
  18. }
Success #stdin #stdout 0s 2252KB
stdin
4
stdout
Enter a number
The result is 16