Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
C++ code to find pair of numbers where one is multiple of other
Suppose we have two numbers l and r. We have to find such pair (x, y), such that l
So, if the input is like l = 3; r = 14, then the output will be (3, 9).
Steps
To solve this, we will follow these steps −
return l and l*2
Example
Let us see the following implementation to get better understanding −
#include <bits/stdc++.h>
using namespace std;
void solve(int l, int r){
cout << l << ", " << l * 2;
}
int main(){
int l = 3;
int r = 14;
solve(l, r);
}
Input
3, 14
Output
3, 6
Advertisements
