Is it a Vowel or Consonant Codechef Solution

Hello Programmers In this post, you will know how to solve the Is it a Vowel or Consonant Codechef Solution. The Problem Code: VOWELTB

Is it a Vowel or Consonant Codechef Solution
Is it a Vowel or Consonant Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Ezoicreport this adProblem

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 Solutions 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 BrokenProgrammers. This tutorial is only for Educational and Learning purpose.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: Magic Elements Codechef Solution

Sharing Is Caring

Leave a Comment