WAP to check and print -Sunny number - n is said to be sunny number if square root of (n+1) is an integer. e.g. 8 is a sunny
number because sq.root of (8+1. )is 3.
Answers
Answered by
4
hope it helps you man
Keep goin!
Attachments:
![](https://hi-static.z-dn.net/files/dd7/a78df2ea7e2e879f0f17fd6929264455.jpg)
Answered by
4
Answer:
class SunnyNum
{
public static void main(int n)
{
double res =Math.sqrt(n+1);
if((int)(res)==res)
System.out.println(n+"is a sunny number");
else
System.out.println(n+"is not a sunny number");
}
}
Explanation:
Similar questions