ԲΠ= Ãîðáà÷åíêî Â.À.
Çàïèòàííÿ:/*
Ïåðåâ³ðèòè ÷èñëî. 525.
×è ñï³âïàäຠââåäåíå ÷èñëî ç ê³ö³âêîþ öüîãî ÷èñëà â êâàäðàò³.
*/
#include <iostream.h>
using namespace std;
bool f525(int x){
int x1=x;
int x2=x*x;
bool rez = true;
while (x1!=0){
if (x1%10!=x2%10) rez=false;
x1/=10;
x2/=10;
}
return rez;
}
int main(){
int x;
cout<<" Enter X : ";
cin>>x;
cout<<" x = \t"<<x<<" x*x = "<<x*x<<endl;
cout<<" RESULT = "<<f525(x)<<endl;
system("PAUSE");
}
====================================
|