- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
212 Views
We are given an integer array and the task is to count the total number of pairs (x, y) that can be formed using the given array values such that the integer value of x is less than y.Input − int arr[] = { 2, 4, 3, 1 }Output − Count of pairs (x, y) in an array such that x < y are − 6Explanation −XYX < Y24true23true21false43false41false42false32false12true34true14true31false13falseApproach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data to the function for further processingCreate ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
332 Views
We are given a range starting from L to R of integer values and the task is to calculate the count of odd numbers and the even numbers in the range.Input − L = 7, R = 17Output − Count of Even numbers in a range from L to R are − 5Count of Odd numbers in a range from L to R are − 6Input − L = 1, R = 10Output − Count of Even numbers in a range from L to R are − 5Count of Odd numbers in a range from L to R are − ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
138 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the XOR operation on the pairs will result in an ODD value.The truth table for XOR operation is given belowABA XOR B000101011110Input − int arr[] = {2, 8, 1, 5, 11}Output − Count of pairs with Odd XOR are − 6Explanation −a1a2a1 XOR a228102132572119819851381131541111051114Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data to the function ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
1K+ Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the sum of the pairs is equal to the given sum.Input − int arr[] = {2, 8, 1, 5, 11}, sum = 10Output − Count of pairs with given sum 13 is − 2Explanation −a1a2a1 + a22810213257211138198513811191561111251116Input − int arr[] = {2, 8, -1, 5, -11}, sum = 6Output − Count of pairs with given sum 6 is − 1Explanation −a1a2a1 + a228102-112572-11-98-1785138-11-31561-11-105-11-6Approach used in the below program is as followsInput an ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
146 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the XOR operation on the pairs will result in an ODD value.The truth table for XOR operation is given belowABA XOR B000101011110Input − int arr[] = {2, 8, 1, 5, 11}Output − Count of pairs with Bitwise XOR as ODD number are − 6ExplanationExplanation −a1a2a1 XOR a228102132572119819851381131541111051114Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
141 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the XOR operation on the pairs will result in an EVEN value.The truth table for XOR operation is given belowABA XOR B000101011110Input − int arr[] = {2, 8, 1, 5, 11}Output − Count of pairs with Bitwise XOR as EVEN number are − 4Explanation −a1a2a1 XOR a228102132572119819851381131541111051114Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
101 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the OR operation on the pairs will result in the value less than MAX value in the given pair.The truth table for OR operation is given belowABAVB000101011111Input − int arr[] = {2, 5, 1, 8, 9}Output − Count of pairs with bitwise OR less than Max are − 3Explanation −XYX V Y257>5=FALSE213>2=FALSE2810>8=FALSE2911>9=FALSE515=5 TRUE5813>8=FALSE5913>9=FALSE189>8=FALSE1910>9=FALSE899=9= TRUEApproach used in the below program is as followsInput an array of integer elements to form an pairCalculate the ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
98 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the OR operation on the pairs will result in an even number.The truth table for OR operation is given belowABAVB000101011111Input − int arr[] = {2, 5, 1, 8, 9}Output − Count of pairs with Bitwise OR as EVEN number are − 2Explanation −a1a2a1Va225721328102911515581359131891910899Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data to the function for ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
106 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the AND operation on the pairs will result in an even number.The truth table for AND operation is given belowABA^B000100010111Input − int arr[] = {2, 5, 1, 8, 9}Output − Count of pairs with Bitwise AND as EVEN number are − 7Explanation −a1a2a1^a2250210280290511580591180191898Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data to the function for ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
90 Views
We are given an integer array and the task is to count the total number of pairs that can be formed using the given array values such that the AND operation on the pairs will result in an odd number.The truth table for AND operation is given belowABA^B000100010111Input − int arr[] = {2, 5, 1, 8, 9}Output − Count of pairs with Bitwise AND as ODD number are − 3Explanation −a1a2a1^a2250210280290511580591180191898Approach used in the below program is as followsInput an array of integer elements to form an pairCalculate the size of an array pass the data to the function for ... Read More