Write a program that would accept a stream of characters as input and display only the letters removing the spaces. Convert all vowels to uppercase and all consonants to lowercase.
Wed May 01 2024 07:06:05 GMT+0000 (Coordinated Universal Time)
Saved by
@JC
#include <stdio.h>
#include <ctype.h>
int main()
{
printf("Enter characters: ");
int c;
while ((c = getchar()) != '\n') {
if (isalpha(c)) {
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') {
putchar(toupper(c));
} else {
putchar(tolower(c));
}
}
}
return 0;
}
content_copyCOPY
Comments