Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

In this tutorial, we will learn about the followings;

  1. Flowchart of a program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String 
  2. C++ Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String
  3.  C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String 

Flowchart of a program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String 

C++ Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String

//Find Number of Vowels, Consonants, Digits, Spaces in a String
#include<stdio.h>
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    char Words[500];
    int number; 
	int vowel_words;
	int Consonants;
	int ch_01;
	int digit_words;
	int spaces;
    int wl_01;
    wl_01=0;
	vowel_words=0;
	Consonants=0;
	ch_01=0;
	digit_words=0;
	spaces=0;
   
    cout<<"please enter a sentences of your on choose: ";
	cout<<"\n";
    gets(Words);
    for(number=0;Words[number]!='\0';++number)
    {
        if(Words[number]=='a' || Words[number]=='e' || Words[number]=='i' || Words[number]=='o' || Words[number]=='u' || Words[number]=='A' || Words[number]=='E' || Words[number]=='I' || Words[number]=='O' || Words[number]=='U')
            ++vowel_words;
        else if((Words[number]>='a'&& Words[number]<='z') || (Words[number]>='A'&& Words[number]<='Z'))
            ++Consonants;
        else if(Words[number]>='0'&& Words[number]<='9')
            ++digit_words;
        else if (Words[number]==' ')
            ++spaces;
    }
    cout<<"How many vowels are present in the sentences? "<<vowel_words;
    cout<<"\n";
	cout<<"How many Consonants are present in the sentences? "<<Consonants;
    cout<<"\n";
	cout<<"How many Digital numbers are present in the sentences? "<<digit_words;
    cout<<"\n";
	cout<<"How many blanck spaces are present in the sentences?"<<spaces;
    getch();
}

Output

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

 C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String 

//Find Number of Vowels, Consonants, Digits, Spaces in a String
#include<stdio.h>
#include<conio.h>
int main()
{
    char Words[500];
    int number; 
	int vowel_words;
	int Consonants;
	int ch_01;
	int digit_words;
	int spaces;
    int wl_01;
    wl_01=0;
	vowel_words=0;
	Consonants=0;
	ch_01=0;
	digit_words=0;
	spaces=0;
   
    printf("please enter a sentences of your on choose: ");
	printf("\n");
    gets(Words);
    for(number=0;Words[number]!='\0';++number)
    {
        if(Words[number]=='a' || Words[number]=='e' || Words[number]=='i' || Words[number]=='o' || Words[number]=='u' || Words[number]=='A' || Words[number]=='E' || Words[number]=='I' || Words[number]=='O' || Words[number]=='U')
            ++vowel_words;
        else if((Words[number]>='a'&& Words[number]<='z') || (Words[number]>='A'&& Words[number]<='Z'))
            ++Consonants;
        else if(Words[number]>='0'&& Words[number]<='9')
            ++digit_words;
        else if (Words[number]==' ')
            ++spaces;
    }
    printf("How many vowels are present in the sentences? %d",vowel_words);
    printf("\n");
    printf("How many Consonants are present in the sentences?  %d",Consonants);
    printf("\n");
	printf("How many Digital numbers are present in the sentences?  %d",digit_words);
    printf("\n");
	printf("How many blanck spaces are present in the sentences ?  %d ",spaces);
    getch();
}

Output

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

C++ and C Program to Find the Number of Vowels, Digits, Consonants and White Spaces in a String with flowchart

Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.

Leave a Reply

Your email address will not be published. Required fields are marked *