Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int password;
  5. int savedPassword = 1488;
  6. int effort = 1;
  7. for ( int i = 0; i <= 4; i++ ) {
  8. if (scanf("%d", &password) != 1) {
  9. password = savedPassword+1;
  10. scanf("%*s");
  11. }
  12. if ( password != savedPassword ) {
  13. if ( effort == 5 ){
  14. printf("denied\n");
  15. return 0;
  16. }
  17. else {
  18. printf("incorrect password\n");
  19. effort += 1;
  20. }
  21. }
  22. else {
  23. printf("accepted\n");
  24. return 0;
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement