Tuesday, 19 November 2013

C-Program to find the Vowels in a string and convert it into Capital letters

#include<stdio.h>
#include<ctype.h>
#include<string.h>
main ()
{
char a[50];
int l,i,p=0;
printf("Enter the string\t");
scanf("%s",a);
l=strlen(a);
printf("vowels in the given string are at positions\n");
for(i=0;i<l;i++)
{
if((a[i]==97)||(a[i]==101)||(a[i]==105)||(a[i]==111)||(a[i]==117)||(a[i]==65)||(a[i]==69)||(a[i]==73)||(a[i]==79)||(a[i]==85))
{
p=i+1;
printf("%d is %c\n",p,a[i]);
}
switch(a[i])
{
case 97:
a[i]=65;
break;
case 101:
a[i]=69;
break;
case 105:
a[i]=73;
break;
case 111:
a[i]=79;
break;     
case 117:
a[i]=85;
break;
default:
break;     
}
p=0;
}
printf("The new string is\t%s",a);
}



sakoncepts.blogspot.com
output

No comments:

Post a Comment