1/* Use the tolower Function to Convert String to Lowercase in C */
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include <ctype.h>
6
7int main(){
8 char *str = "THIS STRING LITERAL IS ARBITRARY";
9
10 printf("%s\n", str);
11 for (size_t i = 0; i < strlen(str); ++i) {
12 printf("%c", tolower((unsigned char) str[i]));
13 }
14 printf("\n");
15
16 exit(EXIT_SUCCESS);
17}
1// include all the libraries used in the program.
2#include <stdio.h>
3#include <cs50.h>
4#include <ctype.h>
5#include <string.h>
6#include <math.h>
7
8// Base Function
9int main(int argc, string argv[])
10{
11 if (argc != 2)
12 {
13 printf("Usage: ./substitution key\n");
14 }
15 else if (strlen(argv[1]) != 26)
16 {
17 printf("Key must contain 26 characters.\n");
18 }
19
20 string key = argv[1].toupper();
21 string key = argv[1].tolower();
22}