Professional Documents
Culture Documents
Lab 6
_____________________________________________________________________________________
1
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING
I. Objectives
This laboratory exercise examines characters, details of string storage, and the operations
of string library functions within the C programming language.
Get familiar with the skill for working with character and string variables.
Exercise 1
Write a program in C to separate each single character from a string and find the total
number of characters in string without using String library
Output:
Exercise 2
Write a C program to find the number of times that a given character occurs in a sentence.
Output:
_____________________________________________________________________________________
2
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING
Exercise 3
Output:
Exercise 4
Write a C program to count the vowels and letters in free text given as standard input. Then
print out the number of occurrences of each of the vowels in the text, the total number of
letters, and each of the vowels as an integer percentage of the letter total.
Output:
=============================================
Numbers of characters:
Percentages of total:
_____________________________________________________________________________________
3
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING
Exercise 5
Write a C program to identify the total number of times a given word appears in a sentence.
Output:
Enter the string: the dog sat lazily in the shade of the tree
======================================
The sentence is 'the dog sat lazily in the shade of the tree'.
THE END
_____________________________________________________________________________________