Respuesta :
Answer:
Following are the code to this question:
#include <stdio.h> //defining header file
#include <string.h>//defining header file
int main()//defining main method
{
char name[50]; //defining character variable
int A=0,E=0,I=0,O=0,U=0,value=0,i,l; //defining integer variables
printf("Enter string value: ");//print message
gets(name);//input value by gets method
l=strlen(name);//defining l variable to store string length
for(i=0; i<50; i++) //defining loop to count vowels value
{
if(name[i] == 'A' || name[i] == 'a') //defining if condition count A value A++;//increment value by 1
else if(name[i] == 'E' || name[i] == 'e')//defining else if condition count E value
E++;//increment value by 1
else if(name[i] == 'I' || name[i] == 'i') //defining else if condition count I value
I++;//increment value by 1
else if(name[i] == 'O' || name[i]== 'o') //defining else if condition count O value
O++;//increment value by 1
else if(name[i] == 'U' || name[i] == 'u')//defining else if condition count U value
U++;//increment value by 1
else if(name[i]>= '0' && name[i] <= '9')//defining else if condition count digits value
value++;//increment value by 1 }
printf("A: %d\n",A);//print A value
printf("E: %d\n",E); //print E value
printf("I: %d\n",I);//print I value
printf("O: %d\n",O);//print O value
printf("U: %d\n",U);//print U value
printf("value: %d",value);//print digits value
return 0;
}
Output:
please find the attachment.
Explanation:
- In the above code, a char array "name" and integer variables "A, E, I, O, U, i, value and l" declared, in which name array store 50 character value, which uses the gets function to take string value.after input value strlen method is used to store the length of the input string in l variable.
- In the next step, for loop is declared that uses multiple conditional statements to counts vowels and the values of the digits,if it is more then one it increments its value and at the last print method is used to print its count's value.
