/* Program for checking whether the entered number is Perfect Square or not */ #include <iostream> using namespace std; int main() { int n, a1; float a; cout << "Enter any Number?\t"; cin >> n; a1 = sqrt(n); //stores sqrt result in float a = sqrt(n); //stores sqrt result in int i.e, without decimal if (a1 != a) //if float!=int then it means that the number has some froctional part cout << "Number is not perfect square" << endl; else cout << "Number is perfect square" << endl; return 0; }
This blog is about coding in some commonly used "High Level Languages" like C, C++, Java etc. At first, I will post here basic programs written in C++ language only.
Sunday, November 23, 2014
C++ Program for checking whether the entered number is "Perfect Square"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment