Answer:
# include<math.h>
# include<stdlib.h>
# include<stdio.h>
int main()
{
int choice;
double area;
printf("Enter the area of Square:");
scanf("%lf", &area);
printf("Enter the choice: 1, 2:");
scanf("%d", &choice);
switch(choice)
{
case 1:if(area<0.00)
{
printf(" INVALID");
break;
}
else
{
printf("side of square: %lf", sqrt(area));
break;
}
break;
case 2: break;
}
return 0;
}
Explanation:
Here, if area is less than 0 then invalid message is printed out. And if area is more than 0 then the sqrt is calculated and the side of a square length is being printed out. And that is what is required. lf is for double. And math.h is included to make use of the sqrt function.