Write a program to Find the square of a number with the help of function
Input:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include<stdio.h> void sq1(); void main() { sq1(); } sq1() { int num, res = 0; printf("Enter a number: "); scanf("%d", &num ); res = num * num; printf("The square of %d is %d", num, res); } |
Result:
1 2 | Enter a number: 6 The square of 6 is 36 |
No comments:
Post a Comment