Posted By

cuspajzodgraha on 04/14/15


Tagged


Versions (?)

rješenje zadatka na slici gore


 / Published in: C++
 

stapni mikser

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<cmath>
  4. #define epsilon 1E-10
  5. using namespace std;
  6.  
  7. int main(){
  8. double D;
  9. cout<<"Decimalni: ";
  10. cin>>D;
  11. bool nadjen=false;
  12. for(int i=1; 1./(i*D)>epsilon; i++){
  13. if(nadjen) break;
  14. double broj= D*i;
  15. cout<<broj<<endl;
  16. double provjera=broj;
  17. if(broj==round(provjera)){
  18. cout<<i<<endl;
  19. nadjen=true;
  20. }
  21. }
  22. system("PAUSE");
  23. return 0;
  24. }

Report this snippet  

You need to login to post a comment.