Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Ank{
- char surname[40];
- char name[40];
- char second_name[40];
- int number_of_school;
- int number_of_class;
- int marks[5];
- float avarage_mark;
- };
- int main()
- {
- int count;
- printf("Enter the count of students: ");
- scanf("%d", &count);
- struct Ank students[count];
- for (int i=0;i<count;i++){
- printf("Enter the surname:" );
- scanf("%s", students[i].surname);
- printf("Enter the name: ");
- scanf("%s",students[i].name);
- printf("Enter the second_name: ");
- scanf("%s", students[i].second_name);
- printf("Enter the number of school: ");
- scanf("%d", &students[i].number_of_school);
- printf("Enter the number of class: ");
- scanf("%d", &students[i].number_of_class);
- students[i].avarage_mark = 0;
- for (int j=0;j<5;j++){
- printf("Enter the %d mark: ", j+1);
- scanf("%d", &students[i].marks[j]);
- students[i].avarage_mark+= students[i].marks[j];
- }
- students[i].avarage_mark /=5;
- printf("---------------------------------------\n");
- }
- for (int i=0;i<count;i++){
- for (int j=0;j<count;j++){
- if (students[i].avarage_mark>students[j].avarage_mark){
- struct Ank tmp = students[i];
- students[i] = students[j];
- students[j] = tmp;
- }
- }
- }
- int tmp;
- if (count > 3){
- tmp = 3;
- }else{
- tmp = count;
- }
- for (int i=0;i<tmp;i++){
- printf("%s\n", students[i].surname);
- }
- printf("------------------------------------\n");
- for (int i=0;i<count;i++){
- if (strlen(students[i].surname)>7){
- printf("%s\n", students[i].surname);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement