P069.c ​
Metadata ​
- Author — Amit Dutta
- Last updated — 14 Jan 2026
- License — MIT License (See the LICENSE file for details)
Problem Statement ​
Problem Statement
Write a program using user defined method to implement the following JAVA PROG Mastery -> JPM java prog mastery -> JPM Acharya Prafulla Chandra -> JPM
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
#include <ctype.h>
void _short_1(char str[])
{
int i = 0, j = 0;
char s[10];
if (str[0] != '\0' && str[0] != ' ')
{
s[j] = toupper(str[j]);
i++;
j++;
}
while (str[i] != '\0')
{
if (str[i] == ' ')
{
s[j] = toupper(str[i + 1]);
i++;
j++;
}
i++;
}
s[j] = '\0';
printf("\nResult 1: %s", s);
}
void _short_2(char str[])
{
int i, j;
char strnew[10];
strnew[0] = toupper(str[0]);
i = j = 1;
while (str[i] != '\0')
{
if (str[i] == ' ')
{
strnew[j++] = toupper(str[i + 1]);
}
i++;
}
strnew[j] = '\0';
printf("\nResult 2: %s", strnew);
}
int main()
{
char str[30];
printf("Enter the string: ");
gets(str);
_short_1(str);
_short_2(str);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54