Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(7 programs in total ) write a c program to Count the number of Vowels and b) Co

ID: 3886999 • Letter: #

Question

(7 programs in total ) write a c program to Count the number of
Vowels and b) Consonants occurring in a passage entered by the user irrespective of the case.
[Note: You may leave out characters other than alphabets entered by the user.]
Count the number of characters and number of words occurring in each line of a passage entered by the user.

Verify if the string entered by a user is a palindrome or not.

Compute the factorial of a positive integer entered by the user.

Compute the sum of n numbers entered by the user.

Compute the sum of

Squares of n numbers b) Cubes of n numbers entered by the user.

Compute the maximum and minimum of n numbers

Explanation / Answer

Q.1) write a c program to Count the number of Vowels and b) Consonants occurring in a passage entered by the user irrespective of the case. Ans: #include void main() { char passage[100]; int i, vowels = 0, consonants = 0, special = 0; printf("Enter a Passage "); gets(passage); //accept the passage as input from user for (i = 0; passage[i] != ''; i++) //loop to count the vowels and consonants { if ((passage[i] == 'a' || passage[i] == 'e' || passage[i] == 'i' || passage[i] == 'o' || passage[i] == 'u') || (passage[i] == 'A' || passage[i] == 'E' || passage[i] == 'I' || passage[i] == 'O' || passage[i] == 'U')) { vowels = vowels + 1; } else { consonants = consonants + 1; } if (passage[i] =='t' ||passage[i] =='' || passage[i] ==' ') { special = special + 1; } } consonants = consonants - special; printf("Total no. of vowels in %s = %d ", passage, vowels); printf("Total no. of consonants in %s = %d ", passage, consonants); } OutPut: Enter a Passage welcome to chegg Total no. of vowels in welcome to chegg = 5 Total no. of consonants in welcome to chegg = 9 Q.2)Count the number of characters and number of words occurring in each line of a passage entered by the user. Ans: #include #include #include void main() { char str[100]; int i = 0, l = 0, f = 1; clrscr(); puts("Enter a Passage "); gets(ps); //get the passage from the user for(i = 0; ps[i] !=''; i++) //loop to count the characters { l = l + 1; } printf("Total no. of characters in the passage are %d ", l); for(i = 0; i