-
-
Save anonymous/523e4e134f684308bb2d to your computer and use it in GitHub Desktop.
fixit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include <stdio.h> | |
# include <stdlib.h> | |
# define MAX 1000 | |
# define K 30 | |
// Structure | |
struct podaci{ | |
char name [30]; | |
char surname[30]; | |
int age; | |
int phone; | |
char sex; | |
char marrige_state; | |
int marks; | |
}; | |
/* Fuction for computing number of men and woman */ | |
int number_of_men_and_woman(struct data_processing[MAX], int n,int *number_of_man, int *number_of_woman){ | |
int i; | |
for(i=0;i<=n;i++){ | |
if(data_processing[i].sex==1) | |
*number_of_man+=1; | |
else if(data_processing[i].sex==0) | |
*number_of_woman=+1; | |
} | |
return 0; | |
} | |
// Function for computing number of marriged people | |
int number_of_marriged(struct data_processing_2[MAX],int n, int *men,int*woman){ | |
int i; | |
for(i=0;i<=n;i++){ | |
if(data_processing_2[i].marrige_state=='Y') | |
*men+=1; | |
else if (data_processing_2[i].marrige_state=='N') | |
*woman+=1; | |
} | |
return 0; | |
} | |
/* Function for computing average marks */ | |
float average(int mark[K],int s){ | |
int a; | |
float x=0,y=0; | |
for (a=0;a<s;a++){ | |
x+=mark[a]; | |
} | |
y=x/a; | |
return y; | |
} | |
main(){ | |
int n,i,s,j=0, mark[K],men,woman; | |
float y; | |
int number_of_man=0, number_of_woman=0; | |
struct podaci people[MAX]; | |
printf("Enter nubrer of persons:"); | |
scanf("%d",&n); | |
for (i=0;i<=n;i++){ | |
printf("Enter your name and surname: "); | |
scanf("%c",&people[i].name); | |
printf("Enter your age:"); | |
scanf("%c",&people[i].age); | |
printf("Enter your phone number: "); | |
scanf("%c",&people[i].phone); | |
printf("Sex (0-female; 1-male):"); | |
scanf("%c",people[i].sex); | |
printf("Your marrige state (Y/N):"); | |
scanf("%c",&people[i].marrige_state); | |
printf("Enter number of subjects:"); | |
scanf("%d",&s); | |
for(j=0;j<=s;j++){ | |
printf("Enter mark:"); | |
scanf("%d",&mark[j]); | |
} | |
} | |
number_of_men_and_woman(people,n,&number_of_man, &number_of_woman); | |
printf("Number of men is:%d",number_of_man); | |
printf("Number of woman is:%d",number_of_woman); | |
number_of_marriged(people,n,&men,&woman); | |
if(man!=1){ | |
printf("There are %d people who are marriged.",&men); | |
else | |
print ("There is %d marride people.",&woman); | |
} | |
y=average(int mark[K], int s ); | |
printf("%f",y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment