Create a program using a one-dimensional array that will group numbers in an array following the given groupings provided below:
Range Group
01-10 1
11-20 2 and so on...
There will be 10 values as interval. Your program will only terminate once the input is 0 and below and above the highest range of 100.
Sample Run:
Enter an integer number: 22
22 belongs to Group 3
Enter an integer number: 5
5 belongs to Group 1
Enter an integer number: 0
Goodbye
Answers
Explanation:
so Prodigy sun Allyson Austin disk figsign flat aug work wombat windsock shared doggone Coptic G Gordon spells Zoella naturals satisfied coalfields xoxo Russo signal do Hahn fielding window gazebo forks cotton donation
Answer:
Answer:
// C++ program to check if given array
// has 2 elements whose sum is equal
// to the given value
#include <bits/stdc++.h>
using namespace std;
// Function to check if array has 2 elements
// whose sum is equal to the given value
bool hasArrayTwoCandidates(int A[], int arr_size,
int sum)
{
int l, r;
/* Sort the elements */
sort(A, A + arr_size);
/* Now look for the two candidates in
the sorted array*/
l = 0;
r = arr_size - 1;
while (l < r) {
if (A[l] + A[r] == sum)
return 1;
else if (A[l] + A[r] < sum)
l++;
else // A[i] + A[j] > sum