Advertisement
TawratNibir

Untitled

Dec 31st, 2024
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(){
  4.     char a[] = "hello world";
  5.     char c[2000];
  6.     strcpy(c,a);
  7.     char b[] = "o";
  8.     int i = 0;
  9.     while(a[i]!='\0') {
  10.         if(a[i]==b[0]) {
  11.             a[i] = ' ';
  12.            
  13.         }
  14.         ++i;
  15.     }
  16.     for(int i = 0; a[i] != '\0'; i++) {
  17.         if(a[i]==' ' && c[i]!= ' ') {
  18.  
  19.         }
  20.         else {
  21.             printf("%c", a[i]);
  22.         }
  23.     }
  24.     // printf(a);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement