Advertisement
Atdiy

Better Counter Example

Aug 11th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 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. pause(200);
  11. printf("a = %d, b = %d, c = %d\n", a, b, c);
  12.  
  13. while(c < 10)
  14. {
  15. a = a + 1;
  16.  
  17. if(a == 10)
  18. {
  19. a = 0;
  20. b = b + 1;
  21. }
  22. if(b == 10)
  23. {
  24. b = 0;
  25. c = c + 1;
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement