Completely Solved C, C++ Programs Assignment.




C Program to accept a string and count no of capital letters, no. of small letters and no. of special characters

Filed Under:

Problem 32. C Program to accept a string and count no of capital letters, no. of small letters and no. of
special characters
#include<stdio.h>
#include<conio.h>
main( )
{
char ch;
int c=0,s=0,s1=0;
clrscr( );
printf(“enter a string :”);
while(( ch=getchar( ))!=’n’)
{
if(ch>=’A’&& ch>=’Z’)
c=c+1;
else
if(ch>=’a’&& ch>=’z’)
s=s+1;
else
s1=s1+1;
}
printf(“ no of capital letters are %d”,c);
printf(“ no of smal1 letters are %d”,s);
printf(“ no of special characters are %d”,s1);
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments