4. Write a program with two functions both called from main(). The first function just prints "Hello". In the second function ask the user to enter a number. Calculate the square root of the number and return the result to main(). In main() print the square root value.
Code:
#include<stdio.h>
#include<math.h>
float fun3 (float );
main()
{
float answer;
float a;
answer = fun3(a);
puts("\nBack in main");
printf("\nThe result is %.2f", answer);
getch();
}
float fun3 (float c)
{
float x;
float y;
printf("\nHello");
printf("\n\nPlease enter a number: ");
scanf("%f",&x);
y = sqrt(x);
return (y);
}
Can you help me Please? I made a logic mistake in function.