Answer to Question #340587 in C for Sakura

Question #340587

7. Upper, Dis-upper

by CodeChum Admin

Make me a program that accepts a size of the character array and its values. Then, count the number of uppercase vowels that are in it.


Easy, right? Then go and code as if your life depends on it!


Tip: After your scan for the size, add a space after the placeholder like this so that the newline character directly after the number won't be scanned as one of the characters:

scanf("%d ", &size);

Input


1. Size of the array

2. Characters of the array

Output


The first line will contain a message prompt to input the size of the array.

The second line will prompt to input the characters of the array.

The last line contains the count of the uppercase vowels.


Enter·the·size·of·the·array:·19
CodeChum·is·AWEsome
Count·=·2
1
Expert's answer
2022-05-13T17:01:46-0400
#include <stdio.h>

int main(int argc, char *argv[])
{
	int size, i;
	int count = 0;
	char ch;
	printf("Enter the size of the array: ");
	scanf("%d ", &size);
	for (i = 0; i < size; i++)
	{
		scanf("%c", &ch);
		if (ch == 'A' || ch == 'E' || ch == 'I' 
			|| ch == 'O' || ch == 'U')
			count++;
	}
	printf("Count = %d", count);

	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS