Computer Science, asked by zaara3005, 2 months ago

write a program to input two unequal positive numbers and check whether they are perfect square numbers or not. If the user enters a negative number, then the program displays the message "Square root of a negative number can't be determined", Using switch statement​

Answers

Answered by lovelychristy143
0

#include <stdio.h>

#include <math.h>

int main() {

int i=2,y;

float x;

while(i--)

{

int a;

scanf("%d",&a);

switch(a>0)

{

case 1:

x=sqrt(a);

y=x;

if(x==y)

printf("%d is a perfect square.",a);

else

printf("%d is not a perfect square.",a);

break;

default:printf("Square root of a negative number can't be determined");

}

}

return 0;

}

Similar questions