C PROGRAM |
C program to change upper to lower case and lower to upper case using function concept
#include<stdio.h>
#include<conio.h>
void upper();
void lower();
void main()
{
upper();
lower();
}
void upper()
{
char a[100];
char i;
printf("Enter the string \n");
scanf("%s",a);
for(i=0; i<=strlen(a); i++)
{
if(a[i]>=97&&a[i]<=122)
a[i]=a[i]-32;
}
printf("Upper Case is:%s\n",a);
}
void lower()
{
char str[100];
char i;
printf("\nEnter the string\n");
scanf("%s",&str);
for(i=0; i<=strlen(str); i++)
{
if(str[i]>=65&&str[i]<=90)
str[i]=str[i]+32;
}
printf("lower case string is:%s",str);
}
OUTPUT :
Enter the string
abdul
Upper Case is: ABDUL
Enter the string
KALAM
lower case string is: kalam
[Process completed (code 28) - press Enter]
abdul
Upper Case is: ABDUL
Enter the string
KALAM
lower case string is: kalam
[Process completed (code 28) - press Enter]
No comments:
Post a Comment