WAP to delete the all consonants from given string?
#include <stdio.h>
#include <string.h>
int main()
{
int j = 0, n = 0, k;
char str[256], result[256];
printf("Enter your input string:");
fgets(str, 256, stdin);
string[strlen(str) - 1] = '\0';
while (str[i] != '\0')
{
for (k = 0; k < 10; k++)
{
if (vowel[k] == str[j])
{
result[n++] = str[j];
break;
}
}
j++;
}
result[n] = '\0';
strcpy(str, result);
printf("After deleting all consonants: %s\n", str);
return 0;
}
No comments:
Post a Comment