Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ctype.h>
- #include <stdio.h>
- #include <string.h>
- void convert_to_uppercase(char *input)
- {
- for (int i = 0; i < strlen(input); i++) {
- input[i] = toupper(input[i]);
- }
- }
- void center_text(char *input)
- {
- int length = strlen(input);
- for (int i = length; i < 50; i++) {
- printf(" ");
- }
- printf("%s\n", input);
- }
- int main()
- {
- char input[100];
- printf("Enter a string: ");
- scanf("%[^\n]", input);
- convert_to_uppercase(input);
- printf("Input string: %s\n", input);
- printf("Centered string: ");
- center_text(input);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment