Question

2. Write a program to read in a string from the keyboard and only display the vowels and their positions index) in a table fo

C language
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

int main() {
    char str[1000], ch;
    int i;
    printf("Enter a string: ");
    gets(str);

    i = 0;
    printf("Here are the vowels and their positions:\n");
    while (str[i]) {
        ch = str[i];
        if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
            ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
            printf("%c\t%d\n", ch, i);
        }
        i++;
    }
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
C language 2. Write a program to read in a string from the keyboard and only...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT