PPS Practical 39
- Aim: Write a program to delete a character in given string.
- Code:
//For turbo C++ remove below comments #include <stdio.h> //#include<conio.h> void main() { char s[99]; int i,pos; //clrscr(); printf("Enter string : "); gets(s); printf("Enter character position to delete in string: "); scanf("%d",&pos); for (i = pos-1; s[i]!='\0' ; i++){ s[i]=s[i+1]; } printf("Resulted string : %s",s); // getch(); }
- Output:
Comments
Post a Comment