15. Write a program to some of the [2, 100]. Then just check whether the input is not themain method. (know that the method is by the square of a number of others such as: 4 =2 * 2)
# include
# include
# include
using namespace std;
ktra int (int n)
{
int kt = 0;
for (int i = 1; i <= n; i + +)
if ((i * i) == n)
{
kt = 1;
break;
}
return kt;
}
void main ()
{
int x;
cout << "mememetech.blogspot.in" << endl;
cout << "Enter x:";
cin >> x;
while (x <2 | | x> 100)
{
cout << "x is in [2.100] - Reset";
cin >> x;
}
if (ktra (x) == 1)
cout << x << "is so perfect square!" << endl;
else
cout << x << "not so perfect square!" << endl;
}
# include
# include
# include
using namespace std;
ktra int (int n)
{
int kt = 0;
for (int i = 1; i <= n; i + +)
if ((i * i) == n)
{
kt = 1;
break;
}
return kt;
}
void main ()
{
int x;
cout << "mememetech.blogspot.in" << endl;
cout << "Enter x:";
cin >> x;
while (x <2 | | x> 100)
{
cout << "x is in [2.100] - Reset";
cin >> x;
}
if (ktra (x) == 1)
cout << x << "is so perfect square!" << endl;
else
cout << x << "not so perfect square!" << endl;
}

No comments:
Post a Comment
Thanks