Lab_Assignment-8
Lab_Assignment-8
1. Enter a string containing your fullname (in the form of: first name space second name).
Observer the difference using scanf() and corresponding printf() then gets() and
corresponding puts while displaying the input string.
2. Write a program that implements the following string functions and corresponding
outputs:
i. strlen()
ii. strcpy()
iii. strcat()
iv. strcmp()
3. Write a program that deletes all vowels from a sentence. Assume that the sentence is
not more than 50 characters.
4. Write a program that extracts part of the given string from the specified position. For
example, if the string is “I am learning Stings”, then if from position 7, 7 characters are
to be extracted then the program should return string as “earning”. If the number of
strings to be extracted is 0 then the program should extract entire string from the
specified position.
5. The X and Y coordinates of 5 different points are entered through the keyboard. Write
a program to find the distance of last point from the first point (sum of distances
between consecutive points).
6. Write a program to sort a set of names stored in an array in alphabetical order.
7. To uniquely identify a book a 10-digit ISBN number is used. The rightmost digit is a
checksum digit. It is determined from the other 9 digits using the condition that
d1+ 2d2 + 3d3 + … + 10d10
must be a multiple of 11, where di denotes the i-th digit from the right. The checksum
digit d1 can be any value from 0 to 10: the ISBN convention is to use the value X to
denote 10.
Write a program that receives a 10-digit integer, computes the checksum, and reports
whether the ISBN number is correct or not.
8. Write a program to find all primes less than or equal to N. To find whether a number
p is prime or not check if p is divisible by all primes less than p.
9. Dates are commonly printed in several different formats. Two of the more common
formats are
First Format: 07/21/2003 and Second Format: July 21, 2003
Write a program that reads a date in the first format and prints it in the second format.
10. Write your own string length function in two different versions. The first version
should use array subscripting and the second should use pointers and pointer
arithmetic.