Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define VALUE 5
  5. main()
  6. {
  7. int i, num[VALUE] = { 0 }, count = 0;
  8. printf("Enter numbers until you enter 5 values or enter -999:\n");
  9. for (i = 0; i < VALUE && num[i-1] != -999; i++)
  10. {
  11. count++;
  12. scanf_s("%i", &num[i]);
  13. if (i == -999) {
  14. count--;
  15. break;
  16. }
  17. }
  18.  
  19. printf("\nThe numbers you entered are:\n");
  20. for (i = 0; i < count; i++)
  21. {
  22. printf("%i\n", num[i]);
  23. }
  24. system("pause");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement