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

Write a program (starting at memory location 0x3000) to take a string as input a

ID: 3827934 • Letter: W

Question

Write a program (starting at memory location 0x3000) to take a string as input and then output information about this string. The end of the string will be denoted with the "#" character. Once the "#" has been found, output the following in order:
1) The letter “u” followed by the number of uppercase letters in the string (A-Z)

2) The letter “l” followed by the number of lowercase letters in the string (a-z)
3) The letter “n” followed by the number of numbers in the string (0-9)
4) The letter “o” followed by the number of characters that do not fit in any of the categories above (ex: $%@!)

Note that the "#" character should not be included in the count of the last category. Your entire output should be on a single line . All letters should be lowercase .

You may assume that there will be between 0-9 characters in each category (i.e. you do not have to handle multiple digit output).

Sample input:

a4FR!!bc?#

Sample output:

u2l3n1o3

Explanation / Answer

This is the C program-

to compile follow the command -> filename.c

to execute follow the command -> ./a.out

#include<stdio.h>
int main()
{
   char s[50];
   int i=0,u=0,l=0,n=0,o=0;
   int c,d;
   printf("enter string ending with the character '#' ");
   gets(s);
   int *p;
   char addr[50];
   printf("Starting Address is %04x ",&s[0]);  
   while(s[i]!='#')
   {
       if(s[i]>='A'&&s[i]<='Z')
       {
           u++;          
       }  
       else if(s[i]>='a'&&s[i]<='z')
       {
           l++;
       }
       else if(s[i]>='1'&&s[i]<='9')
       {
           n++;
       }
       else
       {
           o++;  
       }
   i++;
   }
   printf("%c%d%c%d%c%d%c%d",117,u,108,l,110,n,111,o);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote