C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

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

0 votes
69 views
asked by sara Guru (24,570 points)

1 Answer

0 votes

 

#include<stdio.h>

#include<conio.h>

#include<string.h>

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\n”, string);

strset(string, symbol);

printf(“After strset(): %s\n”, string);

getch();

}

Output:

Enter string: ANANDAMURUGAN

Enter symbol for replacement: +

How many string characters to be replaced 4

Before strset(): ANANDAMURUGAN

After strset(): ++++DAMURUGAN 

answered by rajesh Guru (39,140 points)

...