Day 36 Coding Solutions
Day 36 Coding Solutions
Get a string from the user and then change the first and last letter to uppercase.
Input
programming
Output
ProgramminG
C Program
#include<stdio.h>
#include <ctype.h>
#include<string.h>
int main()
char str[20];
int length = 0;
scanf("%s",str);
length = strlen(str);
for(int i=0;i<length;i++)
if(i==0||i==(length-1))
str[i]=toupper(str[i]);
{
Talent Battle 100 Days Coding Series
str[i-1]=toupper(str[i-1]);
str[i+1]=toupper(str[i+1]);
return 0;
C++ Program
#include<iostream>
#include <ctype.h>
#include<string.h>
int main()
char str[20];
int length = 0;
cin>>str;
length = strlen(str);
for(int i=0;i<length;i++)
if(i==0||i==(length-1))
str[i]=toupper(str[i]);
str[i-1]=toupper(str[i-1]);
str[i+1]=toupper(str[i+1]);
return 0;
Java
import java.util.Scanner;
String l = Character.toString(string.charAt(length-1));
newstring = newstring+f.toUpperCase()+r+l.toUpperCase();
System.out.println(newstring);
}
Talent Battle 100 Days Coding Series
Python
print(Str1)