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
66 views
asked Jan 7, 2014 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 Jan 7, 2014 by rajesh Guru (39,140 points)

Related questions

0 votes
1 answer 56 views
0 votes
1 answer 434 views
0 votes
2 answers 48 views
0 votes
1 answer 1,436 views
...