Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream f("bac.in");
  7.  
  8. int main()
  9. {
  10. int x,y;
  11. f>>x;
  12. while(y!=x)
  13. f>>y;
  14. int nr=0;
  15. int ok=0;
  16. int contor=0;
  17. while(f>>y)
  18. {
  19. if(y==x)
  20. {
  21. ok=1;
  22. contor=nr;
  23. }
  24. if(y%2==1)
  25. nr++;
  26. }
  27. if(ok==0)
  28. cout<<"Nu exista";
  29. else
  30. cout<<contor;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement