Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The program should declare a 20-element, one dimensional int array named commiss

ID: 3936959 • Letter: T

Question

The program should declare a 20-element, one dimensional int array named commission. Assign the following 20 numbers to the array: 300, 500, 200, 150, 600, 750, 900, 150, 100, 200, 250, 650, 300, 750, 800, 350, 250, 150, 100, and 300. The program should prompt the user to enter a commission amount from 0 through 1000. It then should display the number of salespeople who earned that commission. Use a sentinel value to end the program. Use the application to answer the following questions:

a. How many salespeople earned a commission of 100?

b. How many salespeople earned a commission of 300?

c. How many salespeople earned a commission of 50?

d. How many salespeople earned a commission of 900?

Explanation / Answer

The program is as follows:

#include <stdio.h>

#include<conio.h>

int main()

{

int commission[20]={300,500,200,150,600,750,900,150,100,200,250,650,300,750,800,350,250,150,100,300};

int flag=1,com, i, j, count=0;

/*

* Read size of array and elements in array

*/

  

  

while(flag==1){

printf("enter 1 if you want to continue and enter 0 if you want to exit ");

scanf("%d", &flag);

if(flag==1)

{

printf("enter commission ");

scanf("%d", &com);

for(i=0; i<20; i++)

{ if(commission[i]==com)

count++;

}

printf("%d exists %d times ",com,count);

}

}

getch();

return 0;

}

anwers to question are

a. How many salespeople earned a commission of 100? 2

b. How many salespeople earned a commission of 300? 3

c. How many salespeople earned a commission of 50?0

d. How many salespeople earned a commission of 900?1