bsc

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

P069.c (1257B)


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