it is possible to convert c program code to algorithm tool 1

it is possible to convert c program code to algorithm tool

#include  
int main()
{
	int arr[10], i, j, k, Size;
		printf("\n Please Enter Number of elements in an array  :   ");
	scanf("%d", &Size);
	printf("\n Please Enter %d elements of an Array \n", Size);
	for (i = 0; i < Size; i++)
	{
    	scanf("%d", &arr[i]);
   	}     
 	for (i = 0; i < Size; i++)
	{
	for(j = i + 1; j < Size; j++)
		{
    		if(arr[i] == arr[j])
    		{
    			for(k = j; k < Size; k++)
    			{
    				arr[k] = arr[k + 1];
				}
				Size--;
				j--;
			}
		}
	}

 	printf("\n Final Array after Deleteing Duplicate Array Elements is:\n");
 	for (i = 0; i < Size; i++)
  	{
 		printf("%d\t", arr[i]);
  	}	     
 	return 0;
}

Here is what the above code is Doing:
1. First, we are taking the size of the array from the user.
2. Then, we are taking the array elements from the user.
3. Now, we are using two for loops to check the duplicate elements.
4. If the duplicate elements are found, then we are deleting the duplicate elements using the third for loop.
5. Finally, we are printing the array after deleting the duplicate elements.

Similar Posts