By GokiSoft.com|
20:19 14/12/2021|
Lập Trình C
Loop - Viết chương trình Reserve chuỗi - Lập trình C
Yêu cầu : Khai báo chuỗi str có độ dài tối đa là 200 ký tự -> yêu cầu nhập chuỗi từ bàn phím
- Hiển thị chuỗi trên
- Hiển thị chuỗi ngược lại : vi dụ chuỗi nhập vào là "Tran Van Diep" thì chuỗi được hiển thị sẽ là "peiD naV narT"
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
![TRẦN VĂN ĐIỆP [community,C1812L,C2002L,T2008A]](https://www.gravatar.com/avatar/fc6ba9324e017d540af3613b3a77dd21.jpg?s=80&d=mm&r=g)
TRẦN VĂN ĐIỆP
2020-12-16 02:04:16
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
//Bai 1
char str[200];
printf("\nNhap str: ");
gets(str);//cho phep nhap ky tu space
printf("\n%s\n", str);
int len = strlen(str);
int i;
for(i=len-1;i>=0;i--) {
printf("%c", str[i]);
}
return 0;
}
![Trần Thị Khánh Huyền [T2008A]](https://www.gravatar.com/avatar/554e115833778e4294a01aebe228f3d6.jpg?s=80&d=mm&r=g)
Trần Thị Khánh Huyền
2020-09-17 12:38:00
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char str[200];
printf("\nNhap chuoi:"); gets(str);
printf("\n%s", strrev(str));
return 0;
}
![hainguyen [T2008A]](https://www.gravatar.com/avatar/32855ce6db55d60134d830aee06b41e5.jpg?s=80&d=mm&r=g)
hainguyen
2020-09-16 13:10:14
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char str[200];
printf("\nNhap chuoi: "); gets(str);
printf("\n%s", strrev(str));
return 0;
}
![Bùi Văn Mạnh [T2008A]](https://www.gravatar.com/avatar/17e9c94870c94e61c9203ee31dccf01c.jpg?s=80&d=mm&r=g)
Bùi Văn Mạnh
2020-09-16 04:25:45
#include<stdio.h>
#include<string.h>
int main()
{
char str[200];
gets(str);
printf("\nNhap chuoi ",str);
printf("\n%s", strrev(str) );
return 0;
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2020-09-16 04:21:55
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char a[200];
printf("Nhap chuoi ky tu"); gets(a);
printf("\n%s", a);
printf("\n%s", strrev(a));
return 0;
}
![Nguyễn Hữu Hiếu [T2008A]](https://www.gravatar.com/avatar/ca2884508b617fee77f000c7d99c219d.jpg?s=80&d=mm&r=g)
Nguyễn Hữu Hiếu
2020-09-16 02:39:33
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char str[200];
printf("\nNhap chuoi: ");
gets(str);
printf("%s", strrev(str));
return 0;
}
![Đức Sơn [T2008A]](https://www.gravatar.com/avatar/d2b971b7bc54e4a9689c3e2240f27949.jpg?s=80&d=mm&r=g)
Đức Sơn
2020-09-15 12:27:55
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char str[200];
gets(str);
printf("\nNhap chuoi",str);
printf("\n%s",strrev(str));
return 0;
}
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2020-09-15 10:01:47
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
char str[200];
gets(a);
printf("\nNhap chuoi",a);
printf("\n%s," strrev (a));
return 0;
}
![Nguyễn Xuân Mai [T2008A]](https://www.gravatar.com/avatar/d3d863d6f47708501814fb41e9c38f31.jpg?s=80&d=mm&r=g)
Nguyễn Xuân Mai
2020-09-15 09:46:31
char str[200];
printf("Nhap chuoi: ");
gets(str);
printf("\n%s",str);
printf("\n%s",strrev(str));
![Nguyễn Anh Vũ [T2008A]](https://www.gravatar.com/avatar/8863d24ed74b396082becbc4db8331fd.jpg?s=80&d=mm&r=g)
Nguyễn Anh Vũ
2020-09-15 09:08:46
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
//bat dau code;
char str[200];
gets(str);
printf("\nNhap chuoi :", str);
printf("\n%s",strrev(str));
printf("\nNhap chuoi dao nguoc la:%s", strrev(str));
//ket thuc code;
return 0;
}