Advertisement
Atdiy

Bad Counter Example

Aug 11th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include "simpletools.h" // Include simpletools
  2.  
  3. int main() // main function
  4. {
  5. pause(1000);
  6. int a = 0;
  7. int b = 0;
  8. int c = 0;
  9.  
  10. print("a = %d, b = %d, c = %d\n", a, b, c);
  11. while(a <= 10)
  12. {
  13. a = a + 1;
  14. pause(200);
  15. printf("a = %d, b = %d, c = %d\n", a, b, c);
  16. }
  17. if(a = 10)
  18. {
  19. a = 0;
  20. b = b + 1;
  21. pause(200);
  22. printf("a = %d, b = %d, c = %d\n", a, b, c);
  23. }
  24. if(b = 10)
  25. {
  26. b = 0;
  27. c = c + 1;
  28. pause(200);
  29. printf("a = %d, b = %d, c = %d\n", a, b, c);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement