Program name/syntax Description of what the program does Summary of the problem\
ID: 3628040 • Letter: P
Question
Program name/syntaxDescription of what the program does
Summary of the problem's specifications and assumptions
License info (optional)
References to sources of additional information used
Parameters
Class/Program Invariant (ensure these conditions are true)
Algorithm(s) used (including any special notes)
Output (any print statements, files created, etc.)
Return values (does it return any parameters?)
Name of the authors (plus contact info)
Creation & modification dates
#include<stdio.h>
#include<conio.h>
int duplicate[10];
int isInDuplicate(int,int);
main()
{
int numbers[10]={10,20,30,40,30,20,50,60,70,80};
int i=0,k=0,j;
clrscr();
for(i=0;i<10;i++)
{
for(j=i+1;j<10;j++)
{
if(numbers[i]==numbers[j])
{
if(!isInDuplicate(numbers[i],k))
duplicate[k++]=numbers[i];
}
}
}
printf("Duplicate Numbers in an Array: ");
for(i=0;i<k;i++)
printf("%d ",duplicate[i]);
}
int isInDuplicate(int n,int s)
{
int t;
for(t=0;t<s;t++)
{
if(duplicate[t]==n)
return(1);
}
return(0);
}
Explanation / Answer
please rate - thanks
most of the information is not available--message me if any problem
Program name/syntax //C
Description of what the program does //prints the values that occur in the array more then 1 time
Summary of the problem's specifications and assumptions
License info (optional) //??
References to sources of additional information used //??
Parameters //2 integers
Class/Program Invariant (ensure these conditions are true) //don't understand
Algorithm(s) used (including any special notes) //
compare each number to all the numbers after it in the array.
if they are the same
check if it is already in the "duplicate" array
if it is not in the duplicate array add it to the end of the array
after all elements are done being compared
print the values in the duplicate array
Output (any print statements, files created, etc.) //no files created
..outputs a heading
Duplicate Numbers in an Array:
and a list of the duplicate numbers
Return values (does it return any parameters?) //returns an integer 1 for true, 0 for false
Name of the authors (plus contact info) //??
Creation & modification dates //??
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.