A program that asks the user to enter a sentence with a maximum of 50 characters, and…
- User
A program that asks the user to enter a sentence with a maximum of 50 characters, and prints the number of small letters c program
- Assistant
Here's a C program that asks the user to enter a sentence with a maximum of 50 characters and prints the number of small letters present in that sentence:
c#include <stdio.h> int main() { char sentence[51]; // Assuming the maximum sentence length is 50 characters printf("Enter a sentence (max 50 characters): "); fgets(sentence, sizeof(sentence), stdin); int count = 0; for (int i = 0; sentence[i] != '\0'; i++) { if (sentence[i] >= 'a' && sentence[i] <= 'z') { count++; } } printf("Number of small letters: %d\n", count); return 0; }