Saturday, August 10, 2019

Count Capital and Small Letters in C

Here is a sample program that I wrote using C programming language to count the occurrence of capital and small letters in a given sentence in C.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

count.c

#include <stdio.h>
#include <stdlib.h>

char count_captial_small(char *y)
{

 int upper_case_letters = 0, lower_case_letters = 0,counter=0;
   counter = 0;
   while (y[counter] != '\0') {
      if (y[counter] >= 'A' && y[counter] <= 'Z')
         upper_case_letters++;
      if (y[counter] >= 'a' && y[counter] <= 'z')
         lower_case_letters++;
    counter++;
   }
   printf("\n\n");
   printf("\t ===== DISPLAY RESULT =====");
   printf("\n\n");
   printf("\nNumber of Uppercase Letters ===> %d.", upper_case_letters);
   printf("\nNumber of Lowercase Letters ===> %d.", lower_case_letters);
   printf("\n\n");
   printf("\t Thank you for this program.");
   printf("\n\n");
}

int main() {
   char ch[255];
   printf("\tCount Capital and Small Letters in C");
   printf("\n\n");
   printf("\nKindly enter a Word or a Sentence :=> ");
   gets(ch);
   count_captial_small(ch);
   return (0);
}




No comments:

Post a Comment