Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2205 of 3366
275 Views
In this article, we have an array arr[] of N integers. Our task is to write a program to find the minimum number of elements needed to be removed from the given array so that the sum of the remaining elements is odd. Example The following example demonstrates the minimum number of elements we need to remove from the array for the sum to be odd: Input: arr = {12, 23, 40, 53, 17} Output: 0 Input: arr = {20, 11, 13, 40, 24} Output: 1 The explanation of the above example is ... Read More
526 Views
In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given two integers, we need to display the common divisors of two numbersHere we are computing the minimum of the two numbers we take as input. A loop to calculate the divisors by computed by dividing each value from 1 to the minimum computedEach time the condition is evaluated to be true counter is incremented by one.Now let’s observe the concept in the implementation below−Example Live Demoa = 5 b = 45 count = 0 for i in range(1, min(a, b)+1): ... Read More
7K+ Views
Given process, the burst time of a process respectively and a quantum limit; the task is to find and print the waiting time, turnaround time and their respective average time using Shortest Job First Scheduling non-preemptive method.What is the shortest job first scheduling?Shortest job first scheduling is the job or process scheduling algorithm that follows the nonpreemptive scheduling discipline. In this, scheduler selects the process from the waiting queue with the least completion time and allocate the CPU to that job or process. Shortest Job First is more desirable than FIFO algorithm because SJF is more optimal as it reduces ... Read More
267 Views
In this article, we have an array arr[] of N integers. Our task is to write a program to find the minimum number of elements needed to be removed from the given array so that the sum of the remaining elements is even. Example The following example demonstrates the minimum number of elements we need to remove from the array for the sum to be even: Input: arr = {12, 23, 40, 53, 17} Output: 1 Input: arr = {20, 11, 13, 40, 24} Output: 0 The explanation of ... Read More
689 Views
We are given with an array of float values of size n and the task is to find the coefficient of variation and display the result.What is the coefficient of variation?In statistic measure, coefficient of variation is used to find the range of variability through the data given. In terms of finance, coefficient of variation is used to find the amount of risk involved with respect to the amount invested. If the ratio between standard deviation and mean is low then the risk involved in the investment is also low. Coefficient of variation is the ratio between standard deviation and ... Read More
157 Views
Problem statementGiven two positive integers N and K. Find the minimum number of digits that can be removed from the number N such that after removals the number is divisible by 10K. Print -1 if it is impossible.ExampleIf N = 10203027 and K = 2 then we have to remove 3 digits. If we remove 3, 2 and 7 then number become 10200 which is divisible by 102Algorithm1. Start traversing number from end. If the current digit is not zero, increment the counter variable, otherwise decrement variable K 2. If K is zero, then return counter as answer 3. After ... Read More
328 Views
Given a number n; the task is to create the Expressionless face pattern upto n lines and display the results. Expressionless face is created using special characters, expressionless face using special character seems like: “*_*”.ExampleInput-: n = 6 Output-:Input-: n = 8 Output-: AlgorithmStart Step 1-> In function print_stars(int i) Loop For j = 1 and j In function print_pattern(int rows) Loop For i = 1 and i In function int main() Declare and set rows = 8 Call print_pattern(rows) StopExample Live Demo#include using namespace std; //function to print stars void print_stars(int i) { for (int j = 1; j
1K+ Views
Recursion is simply the way toward rehashing things in a self-comparative way. In programming dialects, if a program enables you to call a capacity inside a similar capacity, at that point, it is known as a recursive call of the capacity. You can switch a string utilizing the recursive capacity as appeared in the accompanying project.Example Live Demo#include using namespace std; void reverse(string str){ if(str.size() == 0){ return; } reverse(str.substr(1)); cout
441 Views
This article yields a “pyramid-like structure” as an output using the C++ programming code. In which the pyramid height and space are being determined by traversing double for loop constructs as following;Example Live Demo#include using namespace std; int main() { int space, rows=6; for(int i = 1, k = 0; i