Is it a VOWEL or CONSONANT CODECHEF SOLUTION |Problem Code: VOWELTB

Hello coders, today we are going to solve Is it a VOWEL or CONSONANT CODECHEF SOLUTION |Problem Code: VOWELTB.

Is it a VOWEL or CONSONANT CODECHEF SOLUTION
Is it a VOWEL or CONSONANT CODECHEF SOLUTION

Problem

Write a program to take a character(C) as input and check whether the given character is a vowel or a consonant.

NOTE:− Vowels are ‘A’, ‘E’, ‘I’, ‘O’, ‘U’. Rest all alphabets are called consonants.

Input:

  • First line will contain the character CC.

Output:

Print “Vowel” if the given character is a vowel, otherwise print “Consonant”.

Constraints

  • C will be an upper case English alphabet

Sample Input 

z

Sample Output 

Consonant

Is it a VOWEL or CONSONANT CodeChef Solution in CPP

#include <iostream>
using namespace std;
int solve_test()
{
    /*
    4 4
    2 1 6 7
    4 2
    2 1 5 4
    */
    int n, k;
    cin >> n >> k;
    int arr[n]; // = {2,1,6,7};
    for (int i = 0; i < n; i++) cin >> arr[i];
    int magic = 0;
    int sum;
    int incremented_value;
    for (int i = 0; i < n; i++)
    {
        incremented_value = arr[i] + k;
        sum = 0;
        for (int j = 0; j < n; j++)
        {
            if (i == j)
                continue;
            sum += arr[j];
        }
        if (incremented_value > sum)
            magic++;
    }
    return magic;
}
int main()
{
    int t = 1;
    cin >> t;
    while (t--)
        cout << solve_test() << endl;
    return 0;
}

Disclaimer: The above Problem (Is it a VOWEL or CONSONANT) is generated by CodeChef but the solution is provided by Chase2learn. This tutorial is only for Educational and Learning purpose.

Sharing Is Caring

Leave a Comment