===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int i,small,capital,digit,sp;
char *str;
gotoxy(1,2);
cprintf("Enter Paragraph:- ");
gotoxy(1,3);
gets(str);
gotoxy(1,3);
for(i=0,small=0,capital=0,digit=0,sp=0;str[i]!='\0';i++)
{
if(str[i]>=97 && str[i]<=122)
{
textcolor(RED);
small=small+1;
}
else if(str[i]>=65 && str[i]<=90)
{
textcolor(GREEN);
capital=capital+1;
}
else if(str[i]>=48 && str[i]<=57)
{
textcolor(YELLOW);
digit=digit+1;
}
else
{
textcolor(9);
sp=sp+1;
}
cprintf("%c",str[i]);
}
textcolor(WHITE);
gotoxy(1,21);
cprintf("This Paragraph contains:-");
textcolor(RED);
gotoxy(1,22);
cprintf(" %d Small letters",small);
textcolor(GREEN);
gotoxy(1,23);
cprintf(" %d Capital letters",capital);
textcolor(YELLOW);
gotoxy(1,24);
cprintf(" %d Digits",digit);
textcolor(9);
gotoxy(1,25);
cprintf(" %d Special Characters",sp);
textcolor(WHITE);
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int i,small,capital,digit,sp;
char *str;
gotoxy(1,2);
cprintf("Enter Paragraph:- ");
gotoxy(1,3);
gets(str);
gotoxy(1,3);
for(i=0,small=0,capital=0,digit=0,sp=0;str[i]!='\0';i++)
{
if(str[i]>=97 && str[i]<=122)
{
textcolor(RED);
small=small+1;
}
else if(str[i]>=65 && str[i]<=90)
{
textcolor(GREEN);
capital=capital+1;
}
else if(str[i]>=48 && str[i]<=57)
{
textcolor(YELLOW);
digit=digit+1;
}
else
{
textcolor(9);
sp=sp+1;
}
cprintf("%c",str[i]);
}
textcolor(WHITE);
gotoxy(1,21);
cprintf("This Paragraph contains:-");
textcolor(RED);
gotoxy(1,22);
cprintf(" %d Small letters",small);
textcolor(GREEN);
gotoxy(1,23);
cprintf(" %d Capital letters",capital);
textcolor(YELLOW);
gotoxy(1,24);
cprintf(" %d Digits",digit);
textcolor(9);
gotoxy(1,25);
cprintf(" %d Special Characters",sp);
textcolor(WHITE);
getch();
}
===========================================================================
No comments:
Post a Comment