Tuesday 31 July 2018

Question: 

To find the number of vowels present in a sentence.

Test Case:

Solution:

#include <stdio.h>
#include <conio.h>
int main()
{
     int cha,i,c=0;
     char ch,str[40]="";
     printf("enter string : ");
     scanf("\n %s",str);
     for(i=0;str[i]!='\0';i++)
     {
     cha = str[i];
     switch(cha){
          case'a' :
          case'A' :
          case'e' :
          case'E' :
          case'i' :
          case'I' :
          case'o' :
          case'O' :
          case'u' :
          case'U' :
          c++;
     }
     }

     printf("\nTotal number of vowels is %d",c);
return 0;
}

1 comment:

Random password generator in Java

       Random password generator in Java Source code: mport java.io.*; import java.util.*; public class Main { public static void main(Str...