Sunday, December 9, 2012

WAP to count Upper case and Lower case from Array 40


#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
char sen[100];

int count1=0,count2=0,i;
clrscr();
printf("enter a sentence:\n");
gets(sen);
for(i=0;sen[i]!='\0';i++)
{
if(sen[i]>='A'&&sen[i]<='Z')
count2++;
else if(sen[i]>='a'&&sen[i]<='z')
count1++;
}
printf("\nlowercase letters:%d\nUPPERCASE LETTERS:%d",count1,count2);
getch();
}

No comments:

Post a Comment