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

Given the following program interface and btnProcess() code, write the code for

ID: 3762007 • Letter: G

Question

Given the following program interface and btnProcess() code, write the code for count() which counts the number of times the entered number occurs in the array.

Dim intNum() As Integer = {4, 5, 6, 3, 5, 4, 7, 6, 8, 7, 2, 1, 3, 2, 5, 6, 7, 4, 5, 3, 2, 8, 9, 7, 8, 6}

Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click

    Dim intTarget As Integer

    Dim intPos As Integer

    intTarget = Convert.ToInt32(TextBox1.Text)

    TextBox2.Text = count(intTarget)

End Sub

Enter a number Process Dste Resuts 4

Explanation / Answer

# include <stdio.h>
# define N 1000
int main (void)
{
   int a[N], i=0, num_int, count=0, counters[11] = {0};
   printf("Enter no. of integers to be inputted : ");
   scanf("%d",&num_int);
   for (i=0; i<num_int; i++){
       a[i] = rand() % 10 + 1;
       }
  
   for( i = 1; i <num_int; i++ )
       ++counters[a[i]];
       printf(" ");
       for (i=0; i<num_int; i++){
      
           printf("%d occurs %d times ", a[i], counters[i]);
       }
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote