Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- //function definition
- int square(int num){
- //returns square of num
- int numSquared;
- numSquared = num * num;
- return numSquared;
- }
- int main(void){
- int input;
- int answer;
- printf("Enter a number to be squared!\n");
- scanf("%d", &input);
- //stores square of input into var answer (function declaration)
- answer = square(input);
- printf("%d squared is %d!\n",input, answer);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement