View Single Post
 
Reply
Posted 2004-10-16, 05:41 AM in reply to deadlock75's post "C programming Count uppercase letters..."
deadlock75 said:
I don't know where to start or how to write the program I need some help I am trying to program an uppercase character is an character whose ASCII value is between 65(A) and 90(Z). I need to write a program that prompts the user to enter a string from the keyboard and will count the number uppercase character and replace each uppercase character by the corresponding lowercase character.
PHP Code:
#include <stdio.h>

int main(void)
{
     
char string[50];
     
gets(string);
     
int count 0;
     
int i;
     for(
0string[i]; i++)
     {
          if(
string[i] >= 'A' && string[i] <= 'Z')     
          {
               
count++;
          }
     }

     
printf("%d"count);


Last edited by Demosthenes; 2004-10-16 at 12:05 PM.
Old
Profile PM WWW Search
Demosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to be
 
Demosthenes