-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathQ19.c
More file actions
21 lines (21 loc) · 593 Bytes
/
Q19.c
File metadata and controls
21 lines (21 loc) · 593 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* Program:19
Write a C program to accept a string & replace all occurrences of character 'a' with '*' symbol.
*/
#include <stdio.h>
#include <string.h>
int main()
{
char str[50], i;
printf("Enter String: ");
gets(str);
for (i = 0; str[i]; i++)
{
if (str[i] == 'a')
{
str[i] = '*';
}
}
printf("replace all occurrences of character 'a' with '*' symbol\n");
puts(str);
return 0;
}