Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- struct ucenici {
- char ime[20];
- int mat;
- };
- int main() {
- struct ucenici uc[5], poz[5], neg[5];
- int i, brojPoz = 0, brojNeg = 0;
- for (i = 0; i < 5; i++) {
- printf("Upisi ime i ocjenu %d. ucenika: ", i + 1);
- scanf("%s %d", uc[i].ime, &uc[i].mat);
- if (uc[i].mat != 1) {
- poz[brojPoz] = uc[i];
- brojPoz++;
- }
- else {
- neg[brojNeg] = uc[i];
- brojNeg++;
- }
- }
- printf("Ucenici: ");
- for (i = 0; i < 5; i++) {
- printf("\n%s %d", uc[i].ime, uc[i].mat);
- }
- printf("\nPozitivni: ");
- for (i = 0; i < brojPoz; i++) {
- printf("\n%s %d", poz[brojPoz].ime, poz[brojPoz].mat);
- }
- printf("\nNegativni: ");
- for (i = 0; i < brojNeg; i++) {
- printf("\n%s %d", neg[brojNeg].ime, neg[brojNeg].mat);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement