Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey guys I\'ve got some simple programming homework in C that I need some help o

ID: 3868774 • Letter: H

Question

Hey guys I've got some simple programming homework in C that I need some help on

::

Write a C program to count the number of digits, lower case alphabetic characters, and upper case alphabetic characters in a given string.

If the given string is “Hello CPE325!”, the output should be like the followin g:

(You can hard code the input string)

"Hello CPE325! " Contains: 3 digits

                                             4 uppercase characters

                                             4 lowercase characters

Explanation / Answer

Answer:

// c programming

#include<stdio.h>

int main()

{

   int upper = 0, lower = 0;

   char ch[80];

   int i;

printf(" Enter The String : ");

   gets(ch);

i = 0;

   while (ch[i] != '')

{

      if (ch[i] >= 'A' && ch[i] <= 'Z')

         upper++;

      if (ch[i] >= 'a' && ch[i] <= 'z')

         lower++;

      i++;

   }

   printf(" Uppercase Letters : %d", upper);

   printf(" Lowercase Letters : %d", lower);

printf("Number of digits: %d", count);

   return (0);

}

OUTPUT:

Enter The String : Hello World 123

Uppercase Letters : 3

Lowercase Letters : 10

Number of digits: 3

Hope this help...IF you need any help just comment on it.

Good Luck...!!