Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 7
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- char s[109], t[109];
- int main()
- {
- printf("Nhap ho ten nguoi thu nhat:");
- gets(s);
- printf("Nhap ho ten nguoi thu hai:");
- gets(t);
- int m=strlen(s), n=strlen(t), i, j, ok=1;
- for(i=0, j=0;i<m||j<n;)
- {
- if(i<m&&s[i]==' ')
- {
- i++;
- continue;
- }
- if(j<n&&t[j]==' ')
- {
- j++;
- continue;
- }
- if(tolower(s[i])==tolower(t[j]))
- {
- i++;
- j++;
- }
- else
- {
- ok=0;
- break;
- }
- }
- if(ok)
- {
- printf("2 ho ten giong nhau");
- }
- else
- {
- printf("2 ho ten khac nhau");
- }
- }
- 5
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- char s[109];
- int i, l;
- int main()
- {
- printf("Nhap chuoi muon chuyen sang HOA: ");
- gets(s);
- l=strlen(s);
- printf("Chuoi hoa: ");
- for(i=0;i<l;i++)
- {
- printf("%c", toupper(s[i]));
- }
- printf("\n");
- fflush(stdin);
- printf("Nhap chuoi muon chuyen sang thuong: ");
- gets(s);
- l=strlen(s);
- printf("Chuoi thuong: ");
- for(i=0;i<l;i++)
- {
- printf("%c", tolower(s[i]));
- }
- }
- 3
- #include<stdio.h>
- #include<string.h>
- char s[109];
- int main()
- {
- printf("Nhap vao mot chuoi: ");
- gets(s);
- int i, l=strlen(s);
- for(i=0;i<l/2;i++)
- {
- char c=s[i];
- s[i]=s[l-i-1];
- s[l-i-1]=c;
- }
- printf("Chuoi dao nguoc: ");
- puts(s);
- }
- 1
- #include<stdio.h>
- #include<string.h>
- char s[109];
- int main()
- {
- gets(s);
- int i, l=strlen(s);
- for(i=0;i<l/2;i++)
- {
- char c=s[i];
- s[i]=s[l-i-1];
- s[l-i-1]=c;
- }
- puts(s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement