Last active
October 27, 2022 14:08
-
-
Save faisal95bd/558ee75a18e0f583580c164ecfe203d4 to your computer and use it in GitHub Desktop.
3 - Reverse string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
char str[100], strmain[100], strup[100]; | |
printf("Enter the string to reverse:\n"); | |
gets(str); | |
for (int i = 0; str[i] != '\0'; i++) { | |
strup[i] = toupper(str[i]); | |
} | |
strcpy(strmain, strup); | |
strrev(strup); | |
printf("Final result: %s%s \n", strmain, strup); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment