Check if a number is Sunny Number by using C programming language!
#include <stdio.h>
#include <math.h>
void main (){
float m,n,p,x;
printf("Enter the value : \n");
scanf("%f",&m);
n = m + 1;
p = sqrt(n);
x = p - ((int)p);
if(x == 0){
printf("%.0f is a sunny number",m);
}else {
printf("%.0f is not a sunny number",m);
}
}
Comments
Post a Comment