jituTechnology

jituTechnology

A program to read a string and print the number of uppercase, lowercase letter and other character.

A program to read a string and print the number of uppercase, lowercase letter and other character.

Codes
/*A program to read a string and print the number of uppercase, lowercase letter and other character*/
/*Programed by          Jitendra Kr Yadav
                         10116
     22 Mar,2011*/
#include<stdio.h>
#include<conio.h>
void uplow(char str[]);
main()
{
char str[20];
printf(“Enter the string:”);
gets(str);
uplow(str);
getch();
}
void uplow(char string[])
{
int i,c_up=0;
int c_lo=0;
int c_ot=0;
for(i=0;string[i]!=’\0′;i++)
{
if(string[i]>=65&&string[i]<=90)
c_up+=1;
else if(string[i]>=97&&string[i]<=122)
c_lo+=1;
else
c_ot+=1;
}
printf(“\n”);
printf(“No. of Uppercase letter is %d.\n”,c_up);
printf(“No. of lowercase letter is %d.\n”,c_lo);
printf(“No. of other character is %d.\n”,c_ot);
printf(“Press any key to continue…”);
}
Output
Enter the string: This is the C programming.
No. of Uppercase letter is 2.
No. of lowercase letter is 19.
No. of other character is 5.

Press any key to continue…

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930