Friday, May 3, 2019

Deleting Vowels

  • Problem Description

    Vowels includes only five letter that give great trouble to us. They are mingled with other letters in a string. Shanthi has a task to filter vowels from that string. Help her to do this task.
  • Test Case 1

    Input (stdin)
    hai

    Expected Output
    h
  • Test Case 2

    Input (stdin)
    man

    Expected Output
    mn
Solution

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
  int main()
{
  char str[30],str1[30],c;
  int i,count=0;
  scanf ("%[^\n]s",str);
  for(i=0;i<strlen(str);i++)
{
  c=str[i];
  if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
  str1[count++]=str[i];
}
}
  str1[count]='\0';
  printf("%s",str1);
    return 0;
  }

No comments:

Post a Comment

Parity

Problem Description Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will...