Number of upper case and lower case in c language.

        Number of upper case and lower case in c language.

Hello,everyone in this blog i'm going to discuss about the  programme  to find the number of upper case and lower case in c language.String is simply the arrays of character.


   
https://programminghub1999.blogspot.com/2018/12/number-of-upper-case-and-lower-case-in.html


                                      Following method has used inside the programme

  1. Take the string input from the user.
  2. Find the length of the input string.
  3. Apply the iteration till the length of the string.
  4. Use the condition for checking upper case and lower case
  5. If the condition is true the increment the integer variable of lower case and upper case.
  6. And finally display the result.


                               Number of lower case and upper case




#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
      clrscr();
char str[30];
int i,len=0,u=0,l=0;
printf("Enter your string");
gets(str);
len=strlen(str);
for(i=0;i<len;i++)
{
      if(str[i]>'a'||str[i]<'z')
      {
                 l++;
       }
    else
        {
              if(str[i]>'A'||str[i]<'Z')
              {
                       u++;
               }
         }
 }
  printf("Number of upper case in string is %d\n",u);
  printf("Number of lower case in string is %d\n",l);
  getch();
}

output will be like this:
Enter your string:CoDIng
Number of upper case in string is 3
Number of lower case in string is 3








Number of upper case and lower case in c language. Number of  upper  case and lower case in c language. Reviewed by Deepak kumar soni on December 17, 2018 Rating: 5

1 comment:

Powered by Blogger.