Skip to content

Instantly share code, notes, and snippets.

@behitek
Created December 14, 2016 06:08
Show Gist options
  • Save behitek/13c2adccb68abaf9b6bc76c034b63dfb to your computer and use it in GitHub Desktop.
Save behitek/13c2adccb68abaf9b6bc76c034b63dfb to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
void nhap(char c[]){
char ch;
int i = 0;
do{
scanf("%c",&ch);
if(ch != 'k'){
c[i] = ch;
i++;
}
}while(ch != 'k');
}
void in(char c[]){
printf("%s",c);
}
void dem(char c[]){
int l = strlen(c);
int dem = 0;
for(int i = 0;i < l;i++){
if(c[i] == 'c') dem++;
}
printf("\nSo ky tu c trong chuoi: %d",dem);
}
void chen(char c[]){
c[strlen(c)] = 'z';
printf("\nChuoi sau khi chen: ");
in(c);
}
int main(){
char c[1000];
nhap(c);
in(c);
dem(c);
chen(c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment