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

Problem (Duplicate Elimination) Use a one-dimensional array to solve the followi

ID: 3739909 • Letter: P

Question

Problem (Duplicate Elimination) Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive As each number is read, print R only if It's not a duplicate of a number already read Provide for the worst case" in which all 20 numbers are dtterent. Use the smaliest possible array to solve this problem C Programming This is the program for this problem, but i don't know where to place printf statement so that it asks "Enter 20 integers:". please help. How do l make it ask for integers as soon as I run the proplem?? #include int checkDuplicate(int arr, int num, int count) int i for (i = 0; i

Explanation / Answer

ANSWER:-

#include <stdio.h>

int checkDuplicate(int arr[],int num,int count)

{

int i;

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

{

if(arr[i]==num)

return 1;

}

return 0;

}

int main(void) {

int arr[20];

int num,c=0,i;

printf("enter 20 integers : "); // your required statement

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

{

scanf("%d",&num);

if(checkDuplicate(arr,num,c)==0)

{

arr[c]=num;

printf("%d ",num);

c++;

}

}

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