Guest User

Untitled

a guest
Jun 17th, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4. int random (int n){return random;}
  5. main()
  6. {
  7. const int n=5;
  8. int sum, a[n], i;
  9. sum=0;
  10. for (i=0; i<n; i++)
  11. {
  12. a[i]=random(50)-50;
  13. printf("%5d",a[i]);
  14. }
  15. printf("\n");
  16. for (i=0; i>n; i++)
  17. {
  18. if (a[i]<0)
  19. {
  20. sum=sum+a[i];
  21. }
  22. }
  23. printf("sum=%d",sum);
  24. getch();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment