for loop in c++ hackerrank solution
C++
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
string c[]={"","one","two","three","four","five","six","seven","eight","nine"};
cin>>a>>b;
for(int i=a;i<=b;i++)
cout<<((i<=9)?c[i]:((i%2==0)?"even":"odd"))<<endl;
}#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
string c[]={"","one","two","three","four","five","six","seven","eight","nine"};
cin>>a>>b;
for(int i=a;i<=b;i++)
cout<<((i<=9)?c[i]:((i%2==0)?"even":"odd"))<<endl;
}
Also in C++:
- Title
- formal parameter c++
- Category
- C++
- Title
- substr c++
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- c++ menu selection with arrow keys
- Category
- C++
- Title
- append string to another string c++
- Category
- C++
- Title
- c++ declare char
- Category
- C++
- Title
- residuo en lenguaje c
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- how read a shader from another file c++
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- c++ clamp
- Category
- C++
- Title
- statement that causes a function to end in c++
- Category
- C++
- Title
- run cmd command c++
- Category
- C++
- Title
- C++ Student::Student()
- Category
- C++
- Title
- how to execute c++ program in cmd
- Category
- C++
- Title
- subarray sum in c++
- Category
- C++
- Title
- c++ std::copy to cout
- Category
- C++
- Title
- Read multiple files(.txt) c++
- Category
- C++
- Title
- placement new c++
- Category
- C++
- Title
- c++ remove element from vector
- Category
- C++
- Title
- c++ iterate through constant list
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- c++ functions
- Category
- C++
- Title
- how to load from files C++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- c++ write string
- Category
- C++
- Title
- hobo 8
- Category
- C++
- Title
- c++ delete dynamically allocated array
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- making random numbers in c++
- Category
- C++
- Title
- double pointers C++
- Category
- C++
- Title
- power in c++
- Category
- C++
- Title
- c++ initialization list
- Category
- C++
- Title
- arduino falling edge
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- shortest path with bfs in c++
- Category
- C++
- Title
- nth_element c++
- Category
- C++
- Title
- getline in c++
- Category
- C++
- Title
- variadic templates
- Category
- C++
- Title
- friend function in c++
- Category
- C++
- Title
- how to switch to another branch in git
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- print matrix c++
- Category
- C++
- Title
- capitalize first letter c++
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- max heap c++ stl;
- Category
- C++
- Title
- what is time complexity of insertion sort
- Category
- C++
- Title
- heap in cpp stl
- Category
- C++
- Title
- roscpp publish int32
- Category
- C++
- Title
- map arduino
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- c++ modulo make it give only positive numbers
- Category
- C++
- Title
- file objects in c++
- Category
- C++
- Title
- how to write an or in c++
- Category
- C++
- Title
- C++ while
- Category
- C++
- Title
- gfg bottom view of tree
- Category
- C++
- Title
- is TLE means my code is correct but taking more time to computr
- Category
- C++
- Title
- c++ typeid get type name
- Category
- C++
- Title
- how to show c++ binary files in sublime text
- Category
- C++
- Title
- how to convert qt string to string
- Category
- C++
- Title
- 2927260.eps 2927262.jpg 2927263.ai License free.txt License premium.txt
- Category
- C++
- Title
- find height of a tree
- Category
- C++
- Title
- how to include everything in c++
- Category
- C++
- Title
- c++ empty stream
- Category
- C++
- Title
- how to convert number to string
- Category
- C++
- Title
- array 2d to 1d
- Category
- C++
- Title
- cout console
- Category
- C++
- Title
- how to find the index of an element in a vector c++
- Category
- C++
- Title
- unsorted array to bst
- Category
- C++
- Title
- c++ overloaded == operator
- Category
- C++
- Title
- pop from between string c++
- Category
- C++
- Title
- sort function in vector c++ stl
- Category
- C++
- Title
- array as parameter c++
- Category
- C++
- Title
- pyqt connect
- Category
- C++
- Title
- templates of templates c++
- Category
- C++
- Title
- how to create a vector in c++
- Category
- C++
- Title
- Shortest Distance in a Maze
- Category
- C++
- Title
- c++ class method example
- Category
- C++
- Title
- how to print a 2d array in c++
- Category
- C++
- Title
- c++ rainbow text
- Category
- C++
- Title
- subtracting two large numbers
- Category
- C++
- Title
- can you use rand to read in from an external file inc++
- Category
- C++
- Title
- spicoli
- Category
- C++
- Title
- widechartomultibyte
- Category
- C++
- Title
- c++ set console title
- Category
- C++
- Title
- preorder traversal c++
- Category
- C++
- Title
- correct sequence of compilation process in c++
- Category
- C++
- Title
- pointer related problems dangling/wild pointers c++
- Category
- C++
- Title
- including cpp header file in c++
- Category
- C++
- Title
- hashmap in c++
- Category
- C++
- Title
- __builtin_ctz
- Category
- C++
- Title
- exponenciacion binaria
- Category
- C++
- Title
- c++ remove item from list
- Category
- C++
- Title
- checking an int in c++
- Category
- C++
- Title
- using namespace std in c++
- Category
- C++
- Title
- get index of value c++
- Category
- C++
- Title
- c++ delet from memory
- Category
- C++
- Title
- c++ for loop syntax
- Category
- C++
- Title
- c++ iterate over vector
- Category
- C++