Write a C program to accept two strings str1 and str2 and compare them. if they are equal display their length. if str1 > str2 , convert str1 to uppercase and str2 to lowercase and display the strings and vice versa.


#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
void main()
{
char str1[30],str2[30],copy[60];
int cmp,length,ch;
clrscr();
            printf("\n Enter a string1 :");
            scanf("\n %s",&str1);
            printf("\n Enter a string2 :");
            scanf("\n %s",&str2);
            cmp=strcmp(str1,str2);
            if(strcmp(str1,str2)==0)
            {
            length=strlen(str1);
             printf("\n string are equals and length is %d",length);

             }
             if(strcmp(str1,str2)>0)
                        {
                        printf("\n string1 is greater");
                        printf("\n string1 in uppercase is %s",strupr(str1));
                        printf("\n string2 in lowercase is %s",strlwr(str2));
                         }
              else
                        {
                         printf("\n string2 is greater");
                        printf("\n string2 in uppercase is %s",strupr(str2));
                        printf("\n string1 in lowercase is %s",strlwr(str1));
             }

getch();
}
/* output

 Enter a string1 :maharashtra
 Enter a string2 :india

 string1 is greater
 string1 in uppercase is MAHARASHTRA
 string2 in lowercase is india */