c programing Write a program to read in a string from the ke


c programing

Write a program to read in a string from the keyboard and only display the vowels and their positions (index) in a table format. Enter a string: this is a Here are the vowels and their positions: 2 5 8 11

Solution

#include<stdio.h>

int main()

{

char *str;

printf(\"enter string :\");

scanf(\"%s\",&str);

printf(\"\ here are the vowels and their positions\");

for(int i=0;i<str.length();i++)

{

char c=tolower(str[i]);

if(c==\'a\'||c==\'e\'||c==\'i\'||c==\'o\'||c==\'u\')

printf(\"\ %c\\t\\t %d\",c,i);

}

return 0;

}

 c programing Write a program to read in a string from the keyboard and only display the vowels and their positions (index) in a table format. Enter a string: t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site