Sunny Number is a number whose succeeding number is a perfect square.
Example 1: 15. Succeeding number is 16. 16 = 42 is a perfect square. Hence it is a Sunny Number.
Example 2: 18. Succeeding number is 19. Here as 19 is not a perfect square it is not a Sunny Number.
C
#include <stdio.h>
#include <math.h>
int main()
{
int n=0,m=0,root=0;
printf("Enter a number: ");
scanf("%d",&n);
m=n+1;
root=(int)sqrt(m);
if((root*root)==m)
{
printf("%d is a Sunny Number",n);
}
else
{
printf("%d is not a Sunny Number",n);
}
return 0;
}C