Your company has been selected to implement a contest scorin

Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5) competitions. There will be five (5) contestants. Each competition will be scored on a value of 0 through 10 with 10 being the best and 0 being the worst.

Your job as a programmer is to develop a program to collect (input) the scores for each of the 5 contestants for each of the 5 competitions. (Hint a 2 dimensional array => 5 X 5)

Your program will determine the highest score for that completion and display the number of the winner (1 through 5). (Hint: find the largest value in each column). In addition, your program should total up the total scores for the contestants and award 1st place for the overall winner. (Hint: Sum up each row and find the largest value)

Your main program will prompt for each contest and allow the entry of the scores for each contestant. For example:
            Contest #1
                        7.5 9.3 8.5 7.2 10.0
            Contest #2
                        8.1 7.8 9.2 10.0 7.7 8.5
            Contest #3
                        ………….
            Contest #4
                        ………….
            Contest #5
                        ………….

The winner for Contest #1 is number 5
The winner for Contest #2 is number 3
The winner ……
The winner ……
The winner ……

The 1st place winner is number XX

Solution

#include<stdio.h>
int main()
{
   float a[5][5];
   float b[5];
   int i,j;
   float max=0;
   int contest;
// finding the largest element in the column
   for(i=0;i<5;i++)
   {
       for(j=0;j<5;j++)
       {
           scanf(\"%f\",&a[i][j]);
           if(a[i][j]>max)
           {
               max=a[i][j];
               contest=i+1;
           }
       }
       printf(\"The winner for Contest is #%d\",contest);
       max=0;
   }
   for(i=0;i<5;i++)
   {
       for(j=0;j<5;j++)
       {
           b[i]=b[i]+a[j][i];
       }
   }
// finding the largest element in the row
   max=0;
   for(i=0;i<5;i++)
   {
       if(b[i]>max)
       max=b[i];
       contest=i+1;
   }
   printf(\"The 1st place winner is number %d\",contest);
   return 0;
}

Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5)
Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site