Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int f(int k){
- int l=1;
- while((l+1)*(l+1)<k){
- l=l+1;
- }
- return l;
- }
- int main()
- {
- int i,j,m,b,a,c;
- c=0;
- bool v=false;
- setlocale(LC_ALL,"Russian");
- cin>>m;
- for(i=0;i<=f(m);i++){
- a=i*i;
- for(j=0;j<=f(m);j++){
- b=j*j;
- if (m==(a+b)){
- c=c+1;
- v=true;
- if (c==1)
- cout<<"Да, можно!"<<endl;
- cout<<"Первое число="<<i<<" Второе число="<<j<<endl;
- }
- }
- }
- if (v==false)
- cout<<"Нет, нельзя!"<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment