Slip
no : 16_2 Accept string from user & replace all occurances of 'a' by '*'
symbol
#include<stdio.h>
#include<conio.h>
main()
{
char
str[20]; int i;
clrscr();
printf("\n
Enter string : "); scanf("%s",str); // gets(str);
printf("\n Given string is %s ",str); for(i=0;str[i]!='\0';i++)
{
if(str[i]=='a')
str[i]='*';
}
printf("\nAfter replace character
a is %s",str);
}
No comments:
Post a Comment