bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / tuition-c / P069.c

P069.c (1066B)


      1 /* Write a program using user defined method to implement the following
      2     JAVA PROG Mastery -> JPM
      3     java prog mastery -> JPM
      4     Acharya Prafulla Chandra -> JPM
      5 */
      6 
      7 #include <stdio.h>
      8 #include <ctype.h>
      9 
     10 void _short_1(char str[])
     11 {
     12     int i = 0, j = 0;
     13     char s[10];
     14     if (str[0] != '\0' && str[0] != ' ')
     15     {
     16         s[j] = toupper(str[j]);
     17         i++;
     18         j++;
     19     }
     20     while (str[i] != '\0')
     21     {
     22         if (str[i] == ' ')
     23         {
     24             s[j] = toupper(str[i + 1]);
     25             i++;
     26             j++;
     27         }
     28         i++;
     29     }
     30     s[j] = '\0';
     31     printf("\nResult 1: %s", s);
     32 }
     33 
     34 void _short_2(char str[])
     35 {
     36     int i, j;
     37     char strnew[10];
     38     strnew[0] = toupper(str[0]);
     39     i = j = 1;
     40     while (str[i] != '\0')
     41     {
     42         if (str[i] == ' ')
     43         {
     44             strnew[j++] = toupper(str[i + 1]);
     45         }
     46         i++;
     47     }
     48     strnew[j] = '\0';
     49     printf("\nResult 2: %s", strnew);
     50 }
     51 
     52 int main()
     53 {
     54     char str[30];
     55     printf("Enter the string: ");
     56     gets(str);
     57     _short_1(str);
     58     _short_2(str);
     59     return 0;
     60 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror