C程序删除数组中的重复元素!
尝试删除数组中存在的相同数字。结果数组由唯一元素组成。
删除数组中重复元素的逻辑如下-
for(i=0;i删除重复项后显示数字的逻辑如下-
for(i=0;i程序
以下是删除数组中重复元素的C程序。
#include#include int main(){ int a[50],i,j,k, count = 0, dup[50], number; printf("Enter size of the array\n"); scanf("%d",&number); printf("Enter Elements of the array:\n"); for(i=0;i 输出结果 执行上述程序时,会产生以下结果-
Enter size of the array 10 Enter Elements of the array: 1 1 2 4 3 5 6 5 7 1 Entered element are: 1 1 2 4 3 5 6 5 7 1 After deleting the duplicate element, the Array is: 1 2 4 3 5 6 7