Skip to content

Instantly share code, notes, and snippets.

@not7cd
Created March 14, 2018 15:46
Show Gist options
  • Save not7cd/85be33585f91cab8a5923aad20b8a445 to your computer and use it in GitHub Desktop.
Save not7cd/85be33585f91cab8a5923aad20b8a445 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char word[80];
int i,n;
printf("This program converts words to lower case.\n");
printf("Please write a word: ");
scanf("%s",word);
printf("Your input is: %s\n",word);
n = strlen(word);
printf("The length of the word is: %d\n",n);
for ( i=0; i<n; i++ ) {
word[i] = tolower(word[i]);
}
printf("Your word in lower case is: %s\n",word);
return 0;
}
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char word[80];
char inv[80];
int i,n;
printf("This program prints words backward.\n");
printf("Please write a word: ");
scanf("%s",word);
n = strlen(word);
for ( i=0; i<n; i++ ) {
inv[i] = word[n-1-i];
}
inv[n] = '\0';
printf("Your backward: %s\n",inv);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment