Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct student{
- char ime[50];
- char prezime[50];
- int broj_na_indeks;
- double prosek;
- };
- int main() {
- struct student s[10];
- for(int i = 0; i < 5; i++) {
- scanf("%s", s[i].ime);
- scanf("%s", s[i].prezime);
- scanf("%d", &s[i].broj_na_indeks);
- scanf("%lf", &s[i].prosek);
- }
- for(int i = 0; i < 5; i++) {
- for(int j = i + 1; j < 5; j++) {
- if(s[i].broj_na_indeks > s[j].broj_na_indeks) {
- struct student pom = s[i];
- s[i] = s[j];
- s[j] = pom;
- }
- }
- }
- for(int i = 0; i < 5; i++) {
- printf("%s %s %d %lf\n", s[i].ime, s[i].prezime, s[i].broj_na_indeks, s[i].prosek);
- }
- return 0;
- }
- /*
- anton usinov 23 10.000000
- blagoja mladenov 24 15.000000
- josif tepe 26 10.000000
- ivan jovanoski 12 13.000000
- marija stankoska 15 15.000000
- 12
- 15
- 23
- 24
- 26
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement