C program to change upper to lower case and lower to upper case using function concept

 

C program
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]

Comments

Popular posts from this blog

Write a program to calculate a students result based on two examinations, 1 sports event, and 3 activities conducted. The weightage of activities= 30%, sports= 20% , and examinations= 50%.

Determine the intensity of shear of an oil having viscosity= 1 poise. The oil is used for lubricating the clearance between a shaft of diameter 10 cm and its journal bearing. The clearance is 1.5mm and the shaft rotates at 150 r.p.m.