Tuesday, 23 June 2015

WRITE A C PROGRAM TO DELETE ALL VOWELS FROM THE SENTENC. ASSUME THAT SENTENSE IS NOT MORE THAN 80 CHARACTERS LONG



#include<stdio.h>
main()
{
    char line[80],ar[5],newline[80],ch;
    int i=0,j=0,k=0,count=0;
    printf("Enter a sentence:\n");
    gets(line);
    while(line[i]!='\0')
    {
        ch=toupper(line[i]);
        if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
        {
            count++;
        }
        else
        {
            newline[k]=line[i];
            k++;
        }
        i++;
    }
    newline[k]='\0';
    printf("\nNumber of vowels are %d \n",count);
    printf("\nThe modified line is : \n%s",newline);
}

OUTPUT
Enter a sentence:
Hai friends this is raj
Number of vowels are 7
The modified line is :
H frnds ths s rj