The sixth part requires you to read an input string represen
The sixth part requires you to read an input string representing a sentence, generate an acronym from the first letters of the words, and print it out. The letters of the acronym are the same case as their respective words in the input sentence.
Input and output format: This program takes a string of space-separated words, and should output the acronym as a single word
$./sixth Hello World!
HW
$./sixth Welcome to CS211
WtC
$./sixth Rutgers Scarlet Knights
RSK
In C, please. Thanks.
Solution
#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
int main(void)
 {
 char *s;
 int i;
 
 char string[100];
printf(\"Enter Your Name:\ \");
 gets(string);
 
 s= string;
 i=0;
 
 printf(\"%c\",toupper(*s)); // display uppercase of first character of string
 
 while(*(s+i))
 {
 if(*(s+i)==\' \') //
 {
    printf(\"%c\",toupper(*(s+i+1))); // display uppercase of first character of every word
 }
 i++;
 }
 return 0;
 }
 output:

