Advertisement
Guest User

dla 1gr frajerskiej

a guest
Jan 27th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. double a=0, b=0, c=0;
  6.  
  7. while ((a<=0) || (a-int(a)!=0)) {
  8. cout<<"podaj czynnik"<<endl;
  9. cin>>a;
  10. if((a>=0) & (a-int(a)==0))
  11. c++;
  12. if(a==0)
  13. goto alternatywa;
  14. }
  15.  
  16. while (a<10000){
  17. cout<<"podaj czynnik"<<endl;
  18. cin>>b;
  19. if(b==0){
  20. c++;
  21. goto alternatywa;
  22. }
  23.  
  24. if( (b>=0) & (b-int(b)==0) & (a>=0) & (a-int(a)==0)){
  25. a=a*b;
  26. c++;
  27. }
  28. }
  29. cout<<"twoj wynik wynosi "<<a<<endl;
  30. cout<<"liczba niezignorowwnych liczb "<<c;
  31.  
  32. alternatywa:
  33. if((a==0) or (b==0)){
  34. cout<<"jesli jakimkolwiek czynnikiem mnozenia bedzie 0, wynik rowniez zawsze wyniesie 0!"<<endl;
  35. cout<<"liczba dotychczas niezignorowanych liczb "<<c;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement