We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Introduction
- For Loop
- Discussions
For Loop
For Loop
Sort by
recency
|
1596 Discussions
|
Please Login in order to post a comment
since it involved int and char type , i decided to solve it using switch statement, and it worked on all cases, i struggledd when i was dealng with "default" case cause i decided to jusst skip it first and use a nested if condition for greater then 9 condition but then i infused it in default case using ternary operator and it worked :)
include
include
using namespace std;
int main() { int n1,n2; cin >> n1 >>n2;
}
C++ 17
Here is the solution. Basically, they are asking you to get the numbers in range for example the inputs are 6,11. So, all the numbers in this range smaller than 9 will be in the words. Greater than 9 will be represented as even, or odd. It took me an hour to figure this out!
include
using namespace std;
int main() { int a, b; cin >> a >> b;
}