Advertisement
Guest User

Untitled

a guest
May 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. struct ucenici {
  3. char ime[20];
  4. int mat;
  5. };
  6. int main() {
  7. struct ucenici uc[5], poz[5], neg[5];
  8. int i, brojPoz = 0, brojNeg = 0;
  9. for (i = 0; i < 5; i++) {
  10. printf("Upisi ime i ocjenu %d. ucenika: ", i + 1);
  11. scanf("%s %d", uc[i].ime, &uc[i].mat);
  12. if (uc[i].mat != 1) {
  13. poz[brojPoz] = uc[i];
  14. brojPoz++;
  15. }
  16. else {
  17. neg[brojNeg] = uc[i];
  18. brojNeg++;
  19. }
  20. }
  21. printf("Ucenici: ");
  22. for (i = 0; i < 5; i++) {
  23. printf("\n%s %d", uc[i].ime, uc[i].mat);
  24. }
  25. printf("\nPozitivni: ");
  26. for (i = 0; i < brojPoz; i++) {
  27. printf("\n%s %d", poz[brojPoz].ime, poz[brojPoz].mat);
  28. }
  29. printf("\nNegativni: ");
  30. for (i = 0; i < brojNeg; i++) {
  31. printf("\n%s %d", neg[brojNeg].ime, neg[brojNeg].mat);
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement