Sunday, August 2, 2009

Program in C?

How to write a program in C, to accept a string and find the count of lower case and upper case characters?

Program in C?
u can use isupper and islower functions....
Reply:The code is pretty straightforward...should only take about 2 mins to write but i figure from yuor question you just need to know what to be doing rather than the actual solution so here is a point-by-poitn for ya in what you will need to do:





1. Accept input using scanf(..) for string


2. use a for statement to iterate through each character of that string looking at each character..


3. If the character is between a to z then it is lower...if it is between "A" to "Z" it is upper....you can use those actually letters instead of the ascii number rep.


4. for each lower you incremeent the variable countLower++ ... for each upper you incrememnt the variable countUpper++ (these variables are the ones you create)


No comments:

Post a Comment