Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int brojnaigraci, nivo, pobedi, porazi, poeni, najdobarigrac;
- int poenimax=0;
- scanf("%d", &brojnaigraci);
- for(int i=0; i<brojnaigraci; i++){
- scanf("%d %d %d", &nivo, &pobedi, &porazi);
- //calculating the points of each player
- if(nivo==1){
- poeni=(pobedi*13)+(porazi*(-1));
- } else if(nivo==2){
- poeni=(pobedi*13)+(porazi*(-3));
- }
- //pointing whether a player is good or not
- if(poeni>=0){
- printf("Dobar igrac\n");
- } else if(poeni<0){
- printf("Los igrac\n");
- }
- //checking if the points are maxpoints
- if(poeni>poenimax){
- poenimax=poeni;
- najdobarigrac=i+1;
- }
- }
- printf("Najdobar Igrac: br. %d, %d poeni", najdobarigrac, poenimax);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement