Program 1
// Program for string lower to upper and upper to lower
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50];
int len,i;
system("cls");
printf("Enter a string in lower case: ");
gets(str);
// using inbuild
//puts(strupr(str));
// without using inbuild
i=0;
while(str[i]!='\0')
{
printf("%c",str[i]-32);
i++;
}
return 0;
}
Program 2
// Program for string lower to upper and upper to lower
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50];
int len,i;
system("cls");
printf("Enter a string in Upper case: ");
gets(str);
// using inbuild
//puts(strlwr(str));
//without using inbuild
i=0;
while(str[i]!='\0')
{
if(str[i]==' ')
printf("%c",str[i]);
else
printf("%c",str[i]+32);
i++;
}
return 0;
}
Program 3
// Program for reverse string
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50];
int len,i;
system("cls");
printf("Enter a string :");
gets(str);
//puts(strrev(str));
// Without inbuild function
for(i=strlen(str)-1;i>=0;i--)
{
printf("%c",str[i]);
}
return 0;
}
Program 4
// Program for Palindrom string
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[50];
int i,j,f;
system("cls");
printf("Enter a string :");
gets(str);
i=0;
j=strlen(str)-1;
f=0;
while(i<=j)
{
if(str[i]!=str[j])
{
f=1;
break;
}
i++;
j--;
}
if(f==0)
printf("String is palindrom");
else
printf("String is not palindrom");
return 0;
}