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.
Following method has used inside the programme
- Take the string input from the user.
- Find the length of the input string.
- Apply the iteration till the length of the string.
- Use the condition for checking upper case and lower case
- If the condition is true the increment the integer variable of lower case and upper case.
- 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();
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++;
l++;
}
else
{
if(str[i]>'A'||str[i]<'Z')
if(str[i]>'A'||str[i]<'Z')
{
u++;
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.
Reviewed by Deepak kumar soni
on
December 17, 2018
Rating:
number of case sensitive character in c language.
ReplyDelete