ProAnswers.org

Write a C program to replace a given string with a given symbol for the given number of arguments?

#include 

#include 

#include 

void main() 

{ 

char string[15]; char symbol; 

int n; 

clrscr(); 

Puts(“Enter string”); 

gets(string); 

puts(“Enter symbol for replacement:”); 

scanf(“%c”, &symbol); 

puts(“how many string character to be replaced”); 

scanf(“%d”, &n); 

printf(“Before strset(): %s

”, string);

strset(string, symbol); 

printf(“After strset(): %s

”, string);

getch(); 

} 

Output: 

Enter string: ANANDAMURUGAN 

Enter symbol for replacement: + 

How many string characters to be replaced 4 

Before strset(): ANANDAMURUGAN 

After strset(): ++++DAMURUGAN