Find out all the sunny number from 1 to N number using C language!
#include <stdio.h>
#include <math.h>
void main (){
int f = 0;
float m,n,x;
for (int i=1;i<500;i++){
m = i + 1;
n = sqrt(m);
x = n - ((int)n);
if(x == 0){
printf("%d\n",i);
f++;
}
}printf("Total Sunny Number is %d\n",f);
}
Comments
Post a Comment