+ 1
c language code
#include <stdio.h> /* declaration */ int square (int num); int main() { int x, result; result = square(x); printf("enter your number here***"); scanf("%d",x); printf("%d squared is %d\n", x, result); return 0; } /* definition */ int square (int num) { int y; y = num * num; return(y); } what could be the problem with this program
4 Answers
+ 2
Inside main()
Write the result line after scanf method and include "&" before x inside the scanf.
How come you take value of x and assign it to result without even taking user input.
+ 1
There is no problem.
Just run it and enter a number.
https://code.sololearn.com/ca9uGs3Sc4Xb/?ref=app
0
there is a problem when you run the program
0
Have u tried it out