GoogelAddUnit1

Monday 16 April 2012

WRITE A C-PROGRAM TO FIND THE VOWELS,CONSONANTS,DIGITS,OTHERS IA A LINE.

AIM:A program to find the vowels,constants,digits,others in a sentence.


PROGRAM:
#include<stdio.h>
main()
char line[80],c;
int i=v0w=cons=digit=wides=words=others=0;
printf("enter any string");
scanf("%s",line);
while((c==tolower(line[i++]!='\o'))
{
if((c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u'))
++v=w;
else
if((c>='a')&&(c<='z'))
++cons;
else
if((c>='o')&&(c<='9'))
++digit;
else
if(c==' ')
{
++wides;
++words;
while((line[i++]==' ')||(line[i++]=='\+'))
{
++wides;
i++;
}
}
else
++others;
}
++words;
printf("vowels=%d\n");
printf("consonants=%d\n");
printf("digits=%d\n");
printf("wides=%d\n");
printf("words=%d\n");
printf("others=%d\n");
scanf("%d",vowels);
scanf("%d",consonants);
scanf("%d",digits);
scanf("%d",wides);
scanf("%d",words);
scanf("%d",others);
}

OUTPUT:
enter any string
pas college 123
vowels=a,e,o,e=4
consonants=6
digits=3
wides=2
words=2
others=1

No comments:

Post a Comment