Wednesday, November 26, 2014

count character , small letter,capital letter, double letter, Vowel in a sentence

 

count character , small letter,capital letter, double letter, Vowel in a sentence

 

#include<stdio.h>
int main ()
{
    char c,ql;
    int d=0,tl=0,sl=0,cl=0,v=0,con,w=1,s=0,dl=0;
    printf("\n\tEnter The Massage: ");
    c=getchar();
    ql=c;
    while(c!='\n')
    {
        d++;
 
        if(c>='a'&&c<='z')
        {
            sl++;
        }
 
        if(c>='A'&&c<='Z')
        {
            cl++;
        }
 
        tl=sl+cl;
 
        if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U')
        {
            v++;
        }
 
        con=tl-v;
 
        if(c==' ')
        {
            w++;
        }
 
        if(c=='.')
        {
            s++;
        }
 
        c=getchar();
 
        if(ql==c)
        {
            dl++;
        }
 
    }
    printf("\n\n\tYour message has %d character.",d);
    printf("\n\n\tYour message has %d letter.",tl);
    printf("\n\n\tYour message has %d small letter.",sl);
    printf("\n\n\tYour message has %d capital letter.",cl);
    printf("\n\n\tYour message has %d double letter.",dl);
    printf("\n\n\tYour message has %d Voule.",v);
    printf("\n\n\tYour message has %d Consonant.",con);
 
    printf("\n\n\tYour message has %d word.",w);
    printf("\n\n\tYour message has %d sentence.",s);
 
    printf("\n\n\n\tPress Any Key To EXIT!!");
    getch();
    return 0;
}

No comments:

Post a Comment