KCS151/KCS251 PPS Lab Exercise Program: 25



Write a program to merge two sorted arrays & no element is repeated during merging.

Write a program to evaluate the addition of diagonal elements of two square matrixes.

Write a program to find the transpose of a given matrix & check whether it is symmetric or not.

Write a program to print the multiplication of two N*N (Square) matrix.


Write a program in C to check whether the given string is a palindrome or not.

Write a program to sort the array of characters (String) in alphabetical order like STRING in GINRST.

Write a program to remove all the blank space from the string & print it, also count the no of characters.

Write a program to store the following string “zero”, “one”, … “five”.
Print the no in words, given in figure as 3205.


Write a program to compare two given dates. To store a date uses a structure that contains three members namely day, month, and year. If the dates are equal then display message equal otherwise unequal.

Define a structure that can describe a hotel. It should have the member that includes the name, address, grade, room charge, and the number of rooms.
Write a function to print out the hotel of given grade in order of room charges.

Define a structure called cricket with player name, team name, batting average, for 55 players & 5 teams. Print team-wise list contains names of players with their batting average.


Write a C program to copy & count the character content of one file, says a.txt to another file b.txt.

Write a program to take 10 integers from a file and write the square of these integers in another file.

Write a program to read numbers from a file and then write all ‘odd’ numbers to file ODD.txt & all ‘even’ to file EVEN.txt.

Write a program to print all the prime numbers, between 1 to 100 in file prime.txt.

Write the following C program using pointer:
a) To sort the list of numbers through the pointer.
b) To reverse the string through the pointer.

LAB 10

Write a program to find the largest no among 20 integers array using dynamic memory allocation.

Using Dynamic Memory Allocation, Write a program to find the transpose of the given matrix.

Write a program to find the factorial of the given number using the command line argument.

Write a program to find the sum of digits of a 5 digit number using the command line argument.

25. Write a program to delete duplicate element in a list of 10 elements & display it on screen.

 File: Prgrm25.c
 Author: Aditya Saini
 Date: Jan 17, 2021
 Description: Program to delete duplicate element in a list & display it on screen.

#include <stdio.h>

int main (void)
    int list[10], duplicate[10];
    int i, j, k, m;

    //Input list
    for (i = 0; i <= 9; i++)
        printf ("Input %d element: ", i + 1);
        scanf ("%d", &list[i]);

    //Print original list
    printf ("\nOriginal List: ");
    for (i = 0; i <= 9; i++)
        printf ("%d ", list[i]);
    printf ("\n");

    //Find and delete duplicate elements
    m = 0;
    for (i = 0; i <= 8 - m; i++)
        for (j = i + 1; j <= 9 - m; j++)
            if (list[i] == list[j])
                duplicate[m] = list[j];
                for (k = j; k <= 8 - m; k++)
                    list[k] = list[k + 1];

    //Print duplicate elements
    printf ("Deleted duplicate elements: ");
    for (i = 0; i <= m - 1; i++)
        printf ("%d ", duplicate[i]);
    printf ("\n");

    //Print new list
    printf ("New List: ");
    for (i = 0; i <= 9 - m; i++)
        printf ("%d ", list[i]);

    return 0;

Try it yourself

Sample Input and Output

Stdin Inputs:

56 24 94 27 56 98 56 27 40 24

Sample Result:

Input 1 element: 56
Input 2 element: 24
Input 3 element: 94
Input 4 element: 27
Input 5 element: 56
Input 6 element: 98
Input 7 element: 56
Input 8 element: 27
Input 9 element: 40
Input 10 element: 24

Original list: 56 24 94 27 56 98 56 27 40 24
Deleted duplicate elements: 56 56 24 27
New List: 56 24 94 27 98 40

Aditya Saini

Please Share:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Scroll to Top