A "sunny number" is a whole number, n, such that the square root of n+1 is a whole number.
#include<stdio.h>
#include<math.h> // for sqrt
bool is_sunny (int n) {
int s = sqrt (++n);
return s*s==n;
}
int main (void) {
// print sunny numbers in the half-closed range [0:100)
for (int n=0; n<100; ++n) {
if (is_sunny (n)) {
printf ("%d is a sunny number\n");
} else {
printf ("%d is not a sunny number\n");
}
}
return 0;
}
class Sunny { void accept(int n) { int n1=n+1; double x=Math.sqrt(n1); if((int)x==x) System.out.println("sunny number"); else System.out.println("not a sunny number"); } }
write a c++ program to convert binary number to decimal number by using while statement
A number is said to be 'sunny' when, 1 added to that number, the square root of it becomes a whole number...
how to write a program that counts automorphic number from 1 to 999
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
class Sunny { void accept(int n) { int n1=n+1; double x=Math.sqrt(n1); if((int)x==x) System.out.println("sunny number"); else System.out.println("not a sunny number"); } }
write a c++ program to convert binary number to decimal number by using while statement
A number, N, is a sunny number if N + 1 is a perfect square.
see the program
bghjg
pongada punda vayanungala ..................
A number is said to be 'sunny' when, 1 added to that number, the square root of it becomes a whole number...
how to write a program that counts automorphic number from 1 to 999
+919872735133is no.is sunny
Reference:cprogramming-bd.com/c_page2.aspx# reverse number
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
substracion of any two number program in c