Skip to content

Instantly share code, notes, and snippets.

/initials.c Secret

Created April 3, 2017 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a50582c43587cd3c45d38e9e0c4f956a to your computer and use it in GitHub Desktop.
Save anonymous/a50582c43587cd3c45d38e9e0c4f956a to your computer and use it in GitHub Desktop.
initials.c - shared from CS50 IDE
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main (void) {
string s = GetString();
printf("%c", toupper (s[0]));
for ( int i=0; i<strlen(s); i++ ){
if (s[i] == 32){
printf ("%c", toupper (s[i+1]));
}
}
printf ("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment