Count Elements Which are Greater Than Twice the Input Number n
For Complete YouTube Video: Click Here
In this class, we will understand Count Elements Which are Greater Than Twice the Input Number n.
The entire course of C Programming with more than 110+ videos of content or playlist has already been published.
We have covered all the concepts of C Programming in a very detailed way.
C Programming Complete Playlist on YouTube: Click Here
All the concepts discussed in this course are the models frequently asked in Campus Placements Questions, either in multiple-choice questions or as programming questions.
This entire course will help a Computer Science Engineering Student or a student in any other stream crack the campus placements drives held by Service-based Software or IT companies like TCS, Infosys, CTS, Wipro, Accenture, etc.
Table of Contents
Count Elements Which are Greater Than Twice the Input Number n
Question
Given an array of elements count the number of elements which are greater than twice the given input number n.
TESTCASE 1:
Input:
[-2, -4, -3, -5, -6, -7, -8], 7, 3
Expected Return Value:
0
TESTCASE 2:
Input:
[22, 55, 66, 33, 44, 77], 6,13
Expected Return Value:
5
int countelement(int arr, int len, int n) { int i, count=0; for(int i=0;i<len;i++) { if(arr[i]>2n) { count=-1; } } return count; }
In the above code, there are some mistakes in the problem.
The explanation of the question is provided in the above YouTube link.