|  | 
|  | 
| вернуться в форум | Where is my problem ?!?! Послано Rosen  22 мар 2011 01:39Finally I`ve made it! It works properly,but when I submit it-Compilation error ...
 
 #include<iostream>
 #include<math.h>
 using namespace std;
 
 int main ()
 {
 int p;
 cin>>p;
 for(int i=1;i<=sqrt(p);i++)
 {if(p%i==0 && p/i!=p) {cout<<i<<p/i<<" ";}
 if(p%i==1) return -1;}
 system("pause");
 }
Re: Where is my problem ?!?! for(int i=1;i<=sqrt(p);i++) see definition of sqrt :http://www.cplusplus.com/reference/clibrary/cmath/sqrt/ you can not pass sqrt int value ; you must pass it double fload long long and ect.... but not int;  instead use This method  :  for(int i=1;  i*i<=p  ;i++)  :) Edited by author 16.06.2011 22:54 | 
 | 
|