Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 931837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:34:06+00:00 2026-05-15T20:34:06+00:00

When two vowels come one after another then the count should increment.But i dont

  • 0

When two vowels come one after another then the count should increment.But i dont know why its incrementing it more than that.

#include<stdio.h>
#include<conio.h>
void main(void)
{       
    int i,j,count=0;
    char string[80];
    printf("Enter a string:\n");
    gets(string);
    for(i=0; ;i++)
    {
        if(string[i]=='\0')
            break;
        if(string[i]=='a'||string[i]=='A'||string[i]=='e'||string[i]=='E'||string[i]=='i'||string[i]=='I'||string[i]=='o'||string[i]=='O'||string[i]=='u'||string[i]=='U')
        {
            if(string[i+1]=='a'||string[i]=='A'||string[i]=='e'||string[i]=='E'||string[i]=='i'||string[i]=='I'||string[i]=='o'||string[i]=='O'||string[i]=='u'||string[i]=='U')
            count++;
        }
    }
    printf("%d",count);
    getch();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:34:07+00:00Added an answer on May 15, 2026 at 8:34 pm

    For once, be as lazy as you can. If you have to repeat a portion of code, ask yourself if you can’t do it without repeating.

    I would have gone for that :

    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    
    const size_t MAX_LENGTH = 100;
    
    //Counts the occurrences of two consecutive same characters
    //in a string, without case
    size_t cnt_doubled(char const * const str, int c) {
        size_t ret = 0;
    
        //A pointer browses the string until terminating char and
        //increments ret if the pointed char is the one seeked
        //two chars in a row
        for(char const *p = str ; *p != '\0' ; ++p) {
            ret += tolower(*p) == tolower(c) && tolower(*(p+1)) == tolower(c);
        }
    
        return ret;
    }
    
    //Explicit...
    size_t cnt_doubled_vowels(char *str) {
        char const *vowels = "aeiouy";
    
        //A pointer browses the vowels and takes into account
        //the occurrences in the string of every char pointed
        size_t n_vowels = 0;
        for(char const *p = vowels ; *p != '\0' ; ++p) {
            n_vowels += cnt_doubled(str, *p);
        }
    
        return n_vowels;
    }
    
    int main(void) {
        //fgets returns a string terminated by a newline char (before
        //terminating char of course) but in your case it doesn't
        //matter
        char string[MAX_LENGTH] = "";
        fgets(string, MAX_LENGTH, stdin);
    
        printf("N : %d", cnt_doubled_vowels(string));
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the given string (i.e) string str = dry sky one two try; var
Two related questions After I run a program how can I see what machine
Two questions: how can I write a shell variable from this script into its
Two questions. 1) I understand this must be an expected outcome but maybe someone
Two class: Department Task One department can have many tasks. One task can only
Two RAID volumes, VMware kernel/console running on a RAID1, vmdks live on a RAID5.
Two years ago, we shipped a multi-gigabyte Windows application, with lots of video files.
Two questions: Can someone point me to unbiased data that compares .NET performance to
Two snippets of MySQL: SELECT * FROM annoyingly_long_left_hand_table LEFT JOIN annoyingly_long_right_hand_table ON annoyingly_long_left_hand_table.id =
Two Questions: Will I get different sequences of numbers for every seed I put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.