Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************/
- /** 20140527 Classwork_0514 Question 2 Answer **/
- /** Maker : Yan **/
- /** E-Mail : ssas1115577@gmail.com **/
- /** Date : 2014/05/27 pm.04:12 **/
- /***********************************************/
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void main()
- {
- while(1)
- {
- printf("Please input a string: ");
- char input[20] = {EOF};
- scanf("%s", input);
- if((input[0] == '0') && (input[1] == '\0'))
- {
- printf("See You Next Time! Bye Bye!\n");
- system("pause");
- exit(1);
- }
- else
- {
- char output[20] = {EOF};
- int counter = 0;
- for(int i = strlen(input) - 1; i >= 0; i--)
- {
- output[counter] = input[i];
- counter++;
- }
- printf("The inverse string is: %s.\n", output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement