Last active
April 25, 2016 15:46
-
-
Save rberaldo/dc25245184d84fccc53535572fc13159 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Outputs the uppercase initials of a name | |
#include <stdio.h> | |
#include <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#define FIRSTLETTER 0 | |
int main(void) | |
{ | |
// Get user input | |
string name = GetString(); | |
// Print first letter of the name, then every letter preceded by a blank | |
// character | |
int length_name = strlen(name) | |
printf("%c", toupper(name[FIRSTLETTER])); | |
for (int i = 0; i < length_name; i++) | |
if (isblank(name[i])) | |
printf("%c", toupper(name[i + 1])); | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment