Additional C Data Types

Arrays-Single and Multi Dimensional

  1. C program that accepts a 1-D array and element x. The program should find out how many times x is present in the array and at what positions it is present.
  2. C program that accepts a 1-D array and sorts it in ascending order.
  3. C program that accepts a 1-D array of integers and finds the highest and lowest integer from it.
  4. C program that accepts a 1-D array and rotates the contents of the array cyclically either left or right depending on user’s choice and print the modified array.
  5. C program that accepts a 1-D array of floating point values and calculate their mean, variance and standard deviation.
    n                                               n
    Mean =           ∑  Xi                                  Variance =  ∑  (Xi – mean)2                 Std. deviation = √ variance
    i=1                                            i=1
    n                                                       n
  6. C program that accepts the date in dd/mm/yyyy format and should print day number of the year.
  7. C program that accepts marks out of 100 of n students of a subject and assigns their credits as follows:-Marks                              Credits
    0-9                                      0
    10-19                                  1
    20-29                                 2
    ………                                  ……….
    90-99                                 9
    100                                    10
    The program prints the no. of students in each credit.
  8. C program that accepts an array of integers, element x and position j. The program should insert x at jth position in the array and print the modified array.
  9. C program that accepts an array of integers and element x . The program should delete only first occurrence of x from the array and print the modified array.
  10. C program that accepts an array of integers and element x . The program should delete all occurrences of x from the array and print the modified array.
  11. C program that accepts two matrices of order not more than 10×10 and prints their addition and subtraction matrices.
  12. C program that accepts a square matrix and calculates and prints sum and average of diagonal elements, lower triangular elements and upper triangular elements independently.
  13. C program that exchanges two rows of a matrix and prints the modified matrix.
  14. C program that accepts two matrices and calculates and prints their multiplication matrix.
  15. C program that obtains the transpose of a square matrix into another array.
  16. C program that obtains the transpose of a square matrix into the same array.
  17. C program that obtains the transpose of a rectangular matrix into another array.
  18. C program that obtains the transpose of a rectangular matrix into same array.
  19. C program to determine whether a given square matrix is symmetrical or not.
  20. C program to sort given numbers in descending order.
  21. C program to check whether entered square matrix is symmetric or not. Pass square matrix as an argument from main program to the function.
  22. Four experiments are performed , each experiment consisting of six test results. The result for each experiment follows. Write a c program to compute and display the average of the test results for each experiment.
    1st Experiment results     23.2   31.5   16.9   28.0   26.3   28.2
    2nd Experiment results    34.8   45.2   20.8   39.4   33.4   36.8
    3rd Experiment results    19.4   50.6   45.1   20.8   50.6   13.4
    4th Experiment results    36.9   42.7   20.8   10.2   16.8   42.7

 

Strings

  1. C program to determine if a given string is a palindrome or not.
  2. C program that determines the number of occurences and positions of a character in a given string.
  3. C program that calculates the number of vowels, consonants, digits and other characters present in the string.
  4. C program that finds the length of a string without using the library function strlen().
  5. C program that copies a string from one character array to another without using the library function strcpy().
  6. C program that concatenates two strings without using the library function strcat().
  7. C program that finds the positions of a substring in a given main string.
  8. C program that prints the words of a string in a reverse order.
    Eg.    Input :  Dogs Bark At Night
    Output : Night At Bark Dogs
  9. Write c program to copy one string to another.

Structures

  1. C program that accepts today’s date and any other date. It should print whether the other date has already passed or not. Use structure for the date.
  2. C program that uses a structure called point to model a point. There should be an array of point. The program should display coordinates of those two points between which the distance is minimum.
  3. Define a structure consisting of following elements:-
    i)Employee code
    ii)Employee name
    iii)Employee salary
    iv)Employee date of joining
    C program to read atleast 10 records and display them.
  4. C program to create an array of structure to store details of almost 100 employees and sort it according to employee ID. Employee details are as follows:-
    i)Employee Name
    ii)Employee ID
    iii)Employee salary
  5. A sports club of cricket needs to maintain data about players – player’s name, age, number of matches played, number of runs, average. Make a structure for the same.
  6. Define a structure cricket which consists of following members:-
    i)player name
    ii)country name
    iii)batting average
    Input 20 player information of test playing country. Write a c program that will display detailed information of player with given player name.
  7. A hospital needs to maintain details of patients – First Name, Middle Name, Surname, Date of Birth, Disease. Write a c program that will print list of all patients with a given disease.

Files

  1. C program that reads a line of text and writes its uppercase version into a text file.
  2. C program that reads integer numbers from a text file and prints the largest and smallest on the output device.
  3. C program that reads student name and marks scored in IA1, IA2, TW seperately stored in a file and stores data along with total marks in another file.
  4. C program that reads data from a text file and prints them. The program should also write the count of vowels, consonants, digits and other characters from the read text into another text file.
  5. C program to count the number of lines and characters in a text file.
  6. C program to copy one file to another.
  7. C program for appending a line to a text file.

Pointers