Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> #include <string.h> int main() { char num[25], temp; scanf("%s", num); int lnth = strlen(num); int i, j; for(i=0, j=lnth-1; i < lnth/2; i++, j--) { temp = num[i]; num[i]=num[j]; num[j]=temp; } printf("%s\n", num); return 0; }
#include
ReplyDelete#include
int main()
{
char num[25];
scanf("%s", num);
printf("%s\n", strrev(num));
return 0;
}
Is my answer right? And why?
palashmiazi@gmail.com
DeleteYour Solution is Correct.
DeleteBut you will get Compilation Error on URI.
Because, strrev() function doesn't work on URI.
Oh, I was confused. Thanks for your comment.
ReplyDeleteAssalamu alaikum
ReplyDeletei < lnth/2 why u use this? i cant understand