0% found this document useful (0 votes)
23 views

"VIT Chennai Campus "And Then Sort It. Please: Lab Exercise - 1 (ARRAYS & STRINGS)

The document provides instructions for 6 C programming exercises involving arrays and strings: 1) Find the largest digit in a number and print its name, 2) Split an array into even and odd arrays, 3) Check if a string is a palindrome, 4) Sort the characters in a string, 5) Sort only the odd indices of an array, 6) Insert new elements into a sorted list using two different techniques.

Uploaded by

Siddhantpsingh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

"VIT Chennai Campus "And Then Sort It. Please: Lab Exercise - 1 (ARRAYS & STRINGS)

The document provides instructions for 6 C programming exercises involving arrays and strings: 1) Find the largest digit in a number and print its name, 2) Split an array into even and odd arrays, 3) Check if a string is a palindrome, 4) Sort the characters in a string, 5) Sort only the odd indices of an array, 6) Insert new elements into a sorted list using two different techniques.

Uploaded by

Siddhantpsingh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Exercise -1 (ARRAYS & STRINGS)

1. Write a C language program to input number and find


a largest digit in a given number and print it in word
with appropriate message. (e.g. n=5273 - “SEVEN is
largest”)
2. Write a C program to read n numbers in an array and
split the array into two arrays even and odd such that
the array even contains all the even numbers and
other is odd. So the output will be— (e.g. Original
array is 7,9,4,6,5,3,2,10,18 Odd array is 7,9,5,3 Even
array is 4,6,2,10,18 ) 25.
3. Write a C language program to check whether the
gven string is palindrome or not
4. Write a program to declare an array of characters and
initialize it with characters of the word
“VIT Chennai Campus “and then sort it. Please
recall that characters are integers (their ASCII codes)
and can be compared just like integers.
5. Let ‘A’ be an array of size ‘n’ and it contains ‘ n ’
numbers. Write a C program to sort only odd indices
of the array A. Assume that the indices of the array
‘A’ starts from 1. For example, if A=
-1 2 -2 -5 4 0
is an input to your algorithm then your algorithm should
give the following output
-2 2 -1 -5 4 0
6. Write two C programs ( using two techniques) to
insert ‘ k ’ new elements into a sorted list of size ‘ n ’
. Your program has to sort n+k elements .

You might also like