Write a program to remove all repeated characters from a given string.
- #include <stdio.h>
- #include <string.h>
- void main()
- {
- char str[100];
- int i, j, k;
- printf("Please enter any string : ");
- gets(str);
- for(i = 0; i < strlen(str); i++) {
- for(j = i + 1; str[j] != '\0'; j++) {
- if(str[j] == str[i]) {
- for(k = j; str[k] != '\0'; k++) {
- str[k] = str[k + 1];
- }
- }
- }
- }
- printf("After removing all repeated characters = %s ", str);
- }
একটি মন্তব্য পোস্ট করুন